Last post Feb 19, 2013 10:53 PM by ToughMan
Member
6 Points
86 Posts
Feb 04, 2013 04:40 PM|adharbert|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"; }
730 Points
544 Posts
Feb 19, 2013 10:53 PM|ToughMan|LINK
adharbert recaptcha:RecaptchaControl
??????????
And plz debug ur js codes to see the returned value
Member
6 Points
86 Posts
asp.net WebForms Ajax Recaptcha .Validate() is always returning false
Feb 04, 2013 04:40 PM|adharbert|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!
Member
730 Points
544 Posts
Re: asp.net WebForms Ajax Recaptcha .Validate() is always returning false
Feb 19, 2013 10:53 PM|ToughMan|LINK
??????????
And plz debug ur js codes to see the returned value