I have ReCaptcha control on my registration form:
<recaptcha:RecaptchaControl ID="ReCaptcha" runat="server" PublicKey="<%$ appSettings:ReCaptchaPublicKey %>" PrivateKey="<%$ appSettings:ReCaptchaPrivateKey %>" Theme="white" />
<asp:CustomValidator ID="ReCaptchaCustomValidator" runat="server" ErrorMessage="ReCaptcha error message." Display="None" ValidationGroup="Step1" EnableClientScript="true" OnServerValidate="ReCaptcha_ServerValidate" />
<asp:ValidationSummary ID="ValidationSummary1" runat="server" DisplayMode="List" ValidationGroup="Step1" CssClass="validationSummary" />
CodeBehind
protected void Re开发者_高级运维Captcha_ServerValidate(object source, ServerValidateEventArgs e)
{
ReCaptcha.Validate();
if (ReCaptcha.IsValid)
e.IsValid = true;
else
e.IsValid = false;
}
If user enter ReCaptcha value not properly, ReCaptcha control disappear after server-side validation.
How can I reload it after validation?
protected void Page_PreRender(object sender, EventArgs e)
{
CaptchaControl1.Enabled = true;
}
精彩评论