How to validate a form reCaptcha in MVC C#
Posted
by
Alexidze
on Stack Overflow
See other posts from Stack Overflow
or by Alexidze
Published on 2012-03-26T21:29:07Z
Indexed on
2012/03/26
23:29 UTC
Read the original article
Hit count: 236
I have a page that contains several forms, by submitting each one of them, next form becomes visible.
the last form contains a recaptcha validator, my problem starts here, if i declare an action result for that page like this
[CaptchaValidator]
public ActionResult myAction(SomeModel model, string lang)
{
return View("towing", model);
}
I'm getting an argument null exeption parameter "Challenge", which in fact means that you have to POST those fields from recaptcha for the validation to appear and I cannot post anyting untill the last for is visible and posted.
then I've added a news ActionResult like myActionValidated, defined a route for it like: mypage/validate pointing to that actionresult
and then i don't know where to go from here, i want simply do display a message if the reCaptcha did not validate and redirect to a URL if it succeeded.
I hope I made myself clear. Thank you in advance
© Stack Overflow or respective owner