I've been following the google recaptcha instructions and am at the point where I want to add server side verification:
https://developers.google.com/recaptcha/docs/verify
But when I look at that page, I get a description of some of the methods, but not instructions on what exactly I write into my view. What exactly do I write onto my view to call on google's verification?
Make sure you reference Recaptcha in your controller and then validate on the post
@using Recaptcha; // goes in your controller
This is an example of how to validate server-side
[HttpPost]
[RecaptchaControlMvc.CaptchaValidator]
public ActionResult ForgotPassword(CheckUsernameViewModel model, bool captchaValid, string captchaErrorMessage) {
if(ModelState.IsValid) {
if(captchaValid) {
// do stuff
}
ModelState.AddModelError("", captchaErrorMessage);
}
return View(model);
}
For all the info, see my posted answer here for the walkthrough to implement correctly.
How to implement Google reCaptcha in an MVC3 application?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With