Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Feb 20, 2013 02:53 AM by ToughMan
Member
129 Points
89 Posts
Feb 04, 2013 08:40 PM|LINK
I used this exact same technique before and it always worked. For some reason when I'm doing this now the isvalide is always returning false. Can anyone explain this? Any help would be great. Every variation I try still returns a fail. Thanks!
<%@ Register TagPrefix="recaptcha" Namespace="Recaptcha" Assembly="Recaptcha" %>
<recaptcha:RecaptchaControl ID="recaptcha" runat="server" Theme="clean" PublicKey="public key string" PrivateKey="private key string" EnableViewState="true" /><br /> <a href="Javascript:frmOnSubmit();" id="lnkSubmit" runat="server" class="button">Submit</a>
<script type="javascript"> function frmOnSubmit() { var challengeField = $("input#recaptcha_challenge_field").val(); var responseField = $("input#recaptcha_response_field").val(); if (responseField.length == 0) { alert('* Must enter a value for Verfication.'); } else { var postData = { 'chall': '\'' + challengeField + '\'', 'response': '\'' + responseField + '\'' }; $.ajax({ type: "post" , url: 'ReCaptchaExample.aspx/CheckCaptcha' , data: JSON.stringify(postData) , contentType: "application/json; charset=utf-8" , dataType: "json" , success: function (data, st) { Recaptcha.reload(); if (st == "success") { alert(data.d); } else { alert("Not Pass"); return false; } }, error: function (data, st) { Recaptcha.reload(); $('#lblMessage2').html('* There was an issue with the form.') return false; } }); } } </script>
[WebMethod] public static string CheckCaptcha(string chall, string response) { Recaptcha.RecaptchaValidator captchaValidtor = new Recaptcha.RecaptchaValidator { PrivateKey = "private key string", RemoteIP = HttpContext.Current.Request.UserHostAddress, Challenge = chall, Response = response }; Recaptcha.RecaptchaResponse recaptchaResponse = captchaValidtor.Validate(); return (recaptchaResponse.IsValid) ? "pass" : "fail"; }
Participant
1490 Points
635 Posts
Feb 20, 2013 02:53 AM|LINK
adharbert recaptcha:RecaptchaControl
??????????
And plz debug ur js codes to see the returned value
adharbert
Member
129 Points
89 Posts
asp.net WebForms Ajax Recaptcha .Validate() is always returning false
Feb 04, 2013 08:40 PM|LINK
I used this exact same technique before and it always worked. For some reason when I'm doing this now the isvalide is always returning false. Can anyone explain this? Any help would be great. Every variation I try still returns a fail.
Thanks!
<recaptcha:RecaptchaControl ID="recaptcha" runat="server" Theme="clean" PublicKey="public key string" PrivateKey="private key string" EnableViewState="true" /><br /> <a href="Javascript:frmOnSubmit();" id="lnkSubmit" runat="server" class="button">Submit</a><script type="javascript"> function frmOnSubmit() { var challengeField = $("input#recaptcha_challenge_field").val(); var responseField = $("input#recaptcha_response_field").val(); if (responseField.length == 0) { alert('* Must enter a value for Verfication.'); } else { var postData = { 'chall': '\'' + challengeField + '\'', 'response': '\'' + responseField + '\'' }; $.ajax({ type: "post" , url: 'ReCaptchaExample.aspx/CheckCaptcha' , data: JSON.stringify(postData) , contentType: "application/json; charset=utf-8" , dataType: "json" , success: function (data, st) { Recaptcha.reload(); if (st == "success") { alert(data.d); } else { alert("Not Pass"); return false; } }, error: function (data, st) { Recaptcha.reload(); $('#lblMessage2').html('* There was an issue with the form.') return false; } }); } } </script>[WebMethod] public static string CheckCaptcha(string chall, string response) { Recaptcha.RecaptchaValidator captchaValidtor = new Recaptcha.RecaptchaValidator { PrivateKey = "private key string", RemoteIP = HttpContext.Current.Request.UserHostAddress, Challenge = chall, Response = response }; Recaptcha.RecaptchaResponse recaptchaResponse = captchaValidtor.Validate(); return (recaptchaResponse.IsValid) ? "pass" : "fail"; }ToughMan
Participant
1490 Points
635 Posts
Re: asp.net WebForms Ajax Recaptcha .Validate() is always returning false
Feb 20, 2013 02:53 AM|LINK
??????????
And plz debug ur js codes to see the returned value