title: Using reCAPTCHA with Classic ASP
body: <p>I'm trying to use this example of classic ASP but I have 2 pages, one is form page, the other is verify page. I'm a total newb at classic ASP so I'm not sure if I'm making some syntax errors or not.</p>
  
  <p><a href="https://developers.google.com/recaptcha/docs/asp" rel="nofollow">https://developers.google.com/recaptcha/docs/asp</a></p>
  
  <p>On my form page, I'm loading reCAPTCHA via JS and that part is working fine. On the verify page, I have the code below.</p>
  
  <p>Main code (I removed stuff from Google that I wasn't going to use like generate a recaptcha form field with ASP)</p>
  
  <pre><code>  recaptcha_challenge_field  = Request.Form("recaptcha_challenge_field")
    recaptcha_response_field   = Request.Form("recaptcha_response_field")
    recaptcha_public_key       = "hidden" //your public key
    recaptcha_private_key      = "hidden" //your private key
  
    // returns "" if correct, otherwise it returns the error response
    function recaptcha_confirm(rechallenge,reresponse)
  
    Dim VarString
    VarString = _
            "privatekey=" &amp; recaptcha_private_key &amp; _
            "&amp;remoteip=" &amp; Request.ServerVariables("REMOTE_ADDR") &amp; _
            "&amp;challenge=" &amp; rechallenge &amp; _
            "&amp;response=" &amp; reresponse
  
    Dim objXmlHttp
    Set objXmlHttp = Server.CreateObject("Msxml2.ServerXMLHTTP")
    objXmlHttp.open "POST", "http://www.google.com/recaptcha/api/verify", False
    objXmlHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
    objXmlHttp.send VarString
  
    Dim ResponseString
    ResponseString = split(objXmlHttp.responseText, vblf)
    Set objXmlHttp = Nothing
  
    if ResponseString(0) = "true" then
      'They answered correctly
       recaptcha_confirm = ""
    else
      'They answered incorrectly
       recaptcha_confirm = ResponseString(1)
    end if
  
    end function
  
    server_response = ""
    newCaptcha = True
    if (recaptcha_challenge_field &lt;&gt; "" or recaptcha_response_field &lt;&gt; "") then
      server_response = recaptcha_confirm(recaptcha_challenge_field, recaptcha_response_field)
      newCaptcha = False
    end if
  </code></pre>
  
  <p>This is where I'm trying to detect if captcha is correct, but it submits form either way.</p>
  
  <pre><code>    if recaptcha_response_field &lt;&gt; "" AND newCaptcha = False then
  // submit form
  Else
    Response.Write "Error: Please fill out all form fields correctly."  
  End If
  </code></pre>