开发者

How can I reload ReCaptcha control after custom validation?

开发者 https://www.devze.com 2023-03-25 12:14 出处:网络
I have ReCaptcha control on my registration form: <recaptcha:RecaptchaControl ID=\"ReCaptcha\" runat=\"server\" PublicKey=\"<%$ appSettings:ReCaptchaPublicKey %>\" PrivateKey=\"<%$ appSet

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;

}

0

精彩评论

暂无评论...
验证码 换一张
取 消