Category / Section
How to overcome the issue captcha in form post validation is always being false ?
1 min read
In the Captcha control with refresh handler, the CaptchaService.IsValid() method always returns false during form post validation.
Solution
To resolve this issue, use the RefreshCaptcha handler method in the controller and refresh the control only when the refresh action is performed. This will prevent the control from refreshing at the time of form post during validation. Kindly refer to the following code.
public ActionResult RefreshCaptcha(CaptchaParams parameters) { if (parameters.CaptchaModel.ActionType == "Refresh") return parameters.CaptchaActions(); else return null; }