Classic ASP Recaptcha2 Solution

1,204 views
Skip to first unread message

Adi

unread,
Mar 19, 2016, 10:23:50 PM3/19/16
to reCAPTCHA
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">


<html>
<head>
<title>Recaptcha Test</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">


</script>
</head>

 <% 
Dim action, reresponse, recaptchagood
action = Request.Form("Action")


If action ="Go" then

 reresponse= Request.form("g-recaptcha-response")
 Dim VarString
 VarString = _
          "?secret=yoursecretkey" & _
          "&response=" & reresponse  & _
  "&remoteip=" & Request.ServerVariables("REMOTE_ADDR") 

 Dim url

  Dim objXmlHttp
  Set objXmlHttp = Server.CreateObject("Msxml2.ServerXMLHTTP")
  
  objXmlHttp.open "POST", url, False
  objXmlHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
  objXmlHttp.send

  Dim ResponseString
  ResponseString = objXmlHttp.responseText
  Response.Write(ResponseString)
  Set objXmlHttp = Nothing
  
 If instr(ResponseString, "success" & chr(34) &": true")>0  then
 recaptchagood="Yes"
{actions here for success}
else
{actions here for fail}
 end if

End if
%>
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
<form action="recaptchatest.asp?" method="POST">
 <div class="g-recaptcha" data-sitekey="yoursitekey"></div>
      <br/>
<input type="hidden" name="Action" value="Go">
      <input type="submit" value="Submit">
</form>
 
</body>
</html>

Adi

unread,
Mar 19, 2016, 10:30:57 PM3/19/16
to reCAPTCHA
You must also request new keys if your going from recaptcha1 to recaptcha2, you cannot use the keys from the original recaptcha.

Adi

Todd Langhill

unread,
Sep 5, 2016, 4:46:19 PM9/5/16
to reCAPTCHA
What are some examples for the

Menashe Bezalel

unread,
Mar 2, 2017, 3:56:31 PM3/2/17
to reCAPTCHA
Why am I getting Server Error if I upload this test code to a page?
Reply all
Reply to author
Forward
0 new messages