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); }
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; }