I am implementing reCaptcha in my MVC project as follows.
[HttpPost]
[ValidateAntiForgeryToken]
[RecaptchaControlMvc.CaptchaValidatorAttribute]
public ActionResult Index(IndexTemp indextemp, bool captchaValid)
{
if (!captchaValid)
{
ModelState.AddModelError("", "You did not type the verification word correctly. Please try again.");
}
if (ModelState.IsValid)
{
// do stuff here
}
}
And in Web.config I have the following.
<add key="ReCaptchaPrivateKey" value="some_key"/>
<add key="ReCaptchaPublicKey" value="another_key"/>
I got reCaptcha from here.
I noticed that reCaptcha does not always work as expected (i.e. sometimes it validates when the words entered are invalid). After a bit of testing I noticed that as long as you enter the first word correctly it will always be valid!
Any ideas?