Recaptcha is launched from the main page management

I have a main page that contains a Login control so that the user can log in / out of any page. However, multiple pages of content require a Recaptcha control. This causes problems because when I try to enter a page with a Recaptcha element, the system expects me to enter words. I know the absence of validation groups in the Recaptcha control and the fact that you cannot have multiple forms on an ASP.NET page. Is there any way around this? The "bright" way that I can think of is in the "Input" event, check the page for the Recaptcha control. If it exists, disable it, otherwise continue. However, this just seems inefficient, especially when there are multiple pages, and most of them will not have Recaptcha controls.

+5
source share
4 answers

A workaround for this problem is this:

  • Set ValidationGroup to the "Login" button. The reCAPTCHA control will not be validated when a button with a ValidationGroup set to non-empty is pressed.
  • On pages that require a reCAPTCHA check, keep the ValidationGroup button non-empty (otherwise the login fields will also be checked), but call RecaptchaControl.Validate () manually in the subroutine.

Discussion of the topic on the official reCAPTCHA dev mailing list .

+3
source

What you need to do is the following:

<form runat="server"></form>

, , .

recaptcha , . <form runat="server"></form>.

, recaptcha html form submit, - . , , recaptcha Page.IsValid.

recaptcha ASP.NET, .
, , : SkipRecaptcha = true

, recaptcha . , . recaptcha, SkipRecaptcha = false Page.Validate(). , , Page.IsValid.

recaptcha, BaseValidator . recaptcha , , recaptcha. . , CausesValidation = false. ​​ , .
, , , recaptcha , . , . , .

0

100%, , ReCaptcha . IsValid . : http://code.google.com/p/recaptcha/issues/detail?id=56#c3

, ReCaptcha , .

0

, SkipRecaptcha=true; . , LoggingIn .

, Recapta, .

protected void Page_Load(object sender, EventArgs e)
{
    if (IsPostback && Request["__EVENTTARGET"] == "ctl00$Login1$loginbuttonID")
        Page.Validators.Remove(recaptcha);
}
0
source

All Articles