Exemple #1
0
        /// <summary>
        /// Two values are of interest to this page. If same hash is obtained, then a real person
        /// submitted the form.
        /// </summary>
        /// <param name="sender">Sender object which fired the event</param>
        /// <param name="e">Parameters sent from the event manager.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            string             recaptchaChallengeField = "";
            string             recaptchaResponseField  = "";
            RealPersonResponse rpr = new RealPersonResponse();

            if (Request.Form["recaptcha_challenge_field"] == null)
            {
                if (Request.QueryString["recaptcha_challenge_field"] == null)
                {
                    recaptchaChallengeField = "";
                }
                else
                {
                    recaptchaChallengeField = Request.QueryString["recaptcha_challenge_field"];
                }
            }
            else
            {
                recaptchaChallengeField = Request.Form["recaptcha_challenge_field"];
            }
            if (Request.Form["recaptcha_response_field"] == null)
            {
                if (Request.QueryString["recaptcha_response_field"] == null)
                {
                    recaptchaResponseField = "";
                }
                else
                {
                    recaptchaResponseField = Request.QueryString["recaptcha_response_field"];
                }
            }
            else
            {
                recaptchaResponseField = Request.Form["recaptcha_response_field"];
            }

            Boolean b = DoValidateGoogleRecaptcha(recaptchaChallengeField, recaptchaResponseField);

            if (b)
            {
                rpr.msg = "Valid";
                rpr.val = 1;
            }
            else
            {
                rpr.msg = "Not Valid";
                rpr.val = 0;
            }
            string s = JsonConvert.SerializeObject(rpr);

            Response.Write(s);
            Response.AddHeader("Access-Control-Allow-Origin", "*");
        }
Exemple #2
0
        /// <summary>
        /// Two values are of interest to this page. If same hash is obtained, then a real person
        /// submitted the form.
        /// </summary>
        /// <param name="sender">Sender object which fired the event</param>
        /// <param name="e">Parameters sent from the event manager.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            RealPersonHash     rph = new RealPersonHash();
            RealPersonResponse rpr = new RealPersonResponse();
            string             defaultRealValue     = null;
            string             defaultRealHashValue = null;

            if (Request.Form["defaultReal"] == null)
            {
                if (Request.QueryString["defaultReal"] == null)
                {
                    defaultRealValue = "";
                }
                else
                {
                    defaultRealValue = Request.QueryString["defaultReal"];
                }
            }
            else
            {
                defaultRealValue = Request.Form["defaultReal"];
            }
            if (Request.Form["defaultRealHash"] == null)
            {
                if (Request.QueryString["defaultRealHash"] == null)
                {
                    defaultRealHashValue = "";
                }
                else
                {
                    defaultRealHashValue = Request.QueryString["defaultRealHash"];
                }
            }
            else
            {
                defaultRealHashValue = Request.Form["defaultRealHash"];
            }
            Boolean b = rph.IsReal(defaultRealValue, defaultRealHashValue);

            if (b)
            {
                rpr.msg = "Valid";
                rpr.val = 1;
            }
            else
            {
                rpr.msg = "Not Valid";
                rpr.val = 0;
            }
            string s = JsonConvert.SerializeObject(rpr);

            Response.Write(s);
            Response.AddHeader("Access-Control-Allow-Origin", "*");
        }