I am trying to use an old version of the Recaptcha Validator on a .net 1.1 project, which can be found here: http://recaptcha.googlecode.com/svn/trunk/recaptcha-plugins/dotnet-old/src/Recaptcha/
The code I have is very similar to an example that can be found at the above link:
<asp:TextBox ID="EmailAddress" runat="server"></asp:TextBox>
<recatpcha:RecaptchaValidator ID="RecaptchaValidator1" runat="server" Theme="Clean" PublicKey="xxxxxxxxxxxxxx" PrivateKey="xxxxxxxxxx" ControlToValidate="EmailAddress"></recatpcha:RecaptchaValidator>
<asp:Button ID="Button1" runat="server" Text="Button" CausesValidation="true" OnClick="Button1_Click" />
The behavior I would like is simple: on page load, the user is presented with a field to enter their email address, a captcha to complete, and a submit button. On submit, if no user is found in our database with that email address, or the captcha is answered incorrectly, a new captcha is displayed along with a appropriate error message. Otherwise, they will receive an email about how to reset their password.
The main issue is that the captcha does not display on page load. When I hit the submit button however, triggering Page.Validate(), the page is reloaded and the captcha is displayed.
Based on this, I figured I'd try a different approach and call Page.Validate() in the page load event to get the captcha to show up initially. This almost worked: the captcha showed up on first page load, but when an invalid email is submitted along with a correct captcha answer, the captcha disappears when the page is reloaded, but of course, the email cannot be sent.
How can I either force the captcha to be rendered when the page is hit initially, or, prevent the captcha from being submitted when an invalid email address is entered?