Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Using Google Recaptcha

Using Google Recaptcha

Using Google Recaptcha

Hello, I'm trying to install Google reCAPTCHA on my website.
I found a good example of Classic ASP installation here:

ASP Example

I have made a basic form:

My Form

The problem is, I tick the box, Google confirms I am not a robot and I submit the form.
On the resulting page it then asks me to complete a captcha again, rather than simply display Correct or Wrong.

Can anybody see any loop here that I'm missing:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  <title> New Document </title>
  <script src='https://www.google.com/recaptcha/api.js'></script>

  <form method="post" action="result.asp">
	<div class="g-recaptcha" data-sitekey="MY-PUBLIC-KEY"></div>
	<input type="submit" value="SUBMIT" />


 recaptcha_challenge_field  = Request("recaptcha_challenge_field")
 recaptcha_response_field   = Request("recaptcha_response_field")
 recaptcha_public_key       = "MY-PUBLIC-KEY" ' your public key
 recaptcha_private_key      = "MY-PRIVATE-KEY" ' your private key
 ' returns the HTML for the widget
 function recaptcha_challenge_writer()
 recaptcha_challenge_writer = _
 "<script type=""text/javascript"">" & _
 "var RecaptchaOptions = {" & _
 "   theme : 'red'," & _
 "   tabindex : 0" & _
 "};" & _
 "</script>" & _
 "<script type=""text/javascript"" src=""http://www.google.com/recaptcha/api/challenge?k=" & recaptcha_public_key & """></script>" & _
 "<noscript>" & _
   "<iframe src=""http://www.google.com/recaptcha/api/noscript?k=" & recaptcha_public_key & """ frameborder=""1""></iframe><br>" & _
     "<textarea name=""recaptcha_challenge_field"" rows=""3""cols=""40""></textarea>" & _
     "<input type=""hidden"" name=""recaptcha_response_field""value=""manual_challenge"">" & _
 end function
 ' returns "" if correct, otherwise it returns the error response
 function recaptcha_confirm(rechallenge,reresponse)
 Dim VarString
 VarString = _
         "privatekey=" & recaptcha_private_key & _
         "&remoteip=" & Request.ServerVariables("REMOTE_ADDR") & _
         "&challenge=" & rechallenge & _
         "&response=" & 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 = ""
   'They answered incorrectly
    recaptcha_confirm = ResponseString(1)
 end if
 end function
 server_response = ""
 newCaptcha = True
 if (recaptcha_challenge_field <> "" or recaptcha_response_field <> "") then
   server_response = recaptcha_confirm(recaptcha_challenge_field, recaptcha_response_field)
   newCaptcha = False  
 end if


 <% if server_response <> "" or newCaptcha then %>
   <% if newCaptcha = False then %>
     <!-- An error occurred -->
   <% end if %>
   <!-- Generating the form -->
   <form action="form.asp" method="post">
 <% else %>
   <!-- The solution was correct -->
 <%end if%>

RE: Using Google Recaptcha

Basically regardless of what happens the first recaptcha (whether right or wrong) sends you to the second recaptcha and the second recaptcha (again regardless of right or wrong) it redirects you back to form.asp without displaying correct or wrong..

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close