Ejemplo n.º 1
0
        protected override bool EvaluateIsValid()
        {
            // This is getting called twice for some reason and fails validation second time so handling once only
            if (this.evaluateIsValidExecuted)
            {
                return(this.IsValid);
            }

            var noCaptchaValidator = new NoCaptchaRequest(this.SiteKey, this.SecretKey);

            this.IsValid = noCaptchaValidator.ValidateResponse();
            this.evaluateIsValidExecuted = true;
            this.Text = noCaptchaValidator.ErrorMessage;

            // Set Error Message for Validation Summary
            if (!this.IsValid && this.Display == ValidatorDisplay.None)
            {
                this.ErrorMessage = noCaptchaValidator.ErrorMessage;
            }

            return(this.IsValid);
        }
Ejemplo n.º 2
0
        protected override bool EvaluateIsValid()
        {
            // This is getting called twice for some reason and fails validation second time so handling once only
            if (this.evaluateIsValidExecuted)
                return this.IsValid;

            var noCaptchaValidator = new NoCaptchaRequest(this.SiteKey, this.SecretKey);
            this.IsValid = noCaptchaValidator.ValidateResponse();
            this.evaluateIsValidExecuted = true;
            this.Text = noCaptchaValidator.ErrorMessage;

            // Set Error Message for Validation Summary
            if (!this.IsValid && this.Display == ValidatorDisplay.None)
            {
                this.ErrorMessage = noCaptchaValidator.ErrorMessage;
            }

            return this.IsValid;
        }