Develop recaptcha validation in c# backend and website

In Html

 <div class="g-recaptcha" data-sitekey="@siteKey"></div>
                                    <script src="https://www.google.com/recaptcha/api.js?hl=en" async defer></script>

C# backend

string EncodedResponse = Request.Form["g-Recaptcha-Response"];
bool IsCaptchaValid = (ReCaptchaClass.Validate(EncodedResponse, secretKey) == "True" ? true : false);


 public class ReCaptchaClass
    {
        public static string Validate(string EncodedResponse, string secretKey)
        {
            var client = new WebClient();      
            var GoogleReply = client.DownloadString(string.Format("https://www.google.com/recaptcha/api/siteverify?secret={0}&response={1}", secretKey, EncodedResponse));

            var captchaResponse = Newtonsoft.Json.JsonConvert.DeserializeObject<ReCaptchaClass>(GoogleReply);

            return captchaResponse.Success;
        }

        [JsonProperty("success")]
        public string Success
        {
            get { return m_Success; }
            set { m_Success = value; }
        }

        private string m_Success;
        [JsonProperty("error-codes")]
        public List<string> ErrorCodes
        {
            get { return m_ErrorCodes; }
            set { m_ErrorCodes = value; }
        }


        private List<string> m_ErrorCodes;

    }

Comments

  1. Develop Recaptcha Validation In C Backend And Website >>>>> Download Now

    >>>>> Download Full

    Develop Recaptcha Validation In C Backend And Website >>>>> Download LINK

    >>>>> Download Now

    Develop Recaptcha Validation In C Backend And Website >>>>> Download Full

    >>>>> Download LINK PL

    ReplyDelete
  2. Best information you have provided to us about games. Thanks for sharing. Looking forward for more posts. captcha app

    ReplyDelete

Post a Comment

Popular posts from this blog

How can we find .net version in server or computer

Download csv file in client side with mvc controller