Recaptcha validation not working in ASP.NET MVC 4

Jul 2, 2013 at 8:03 PM
Hi.

I use Recaptcha in ASP.NET MVC 4 application but the validation not working. I added the control in contact view. If the Recaptcha code is wrong or empty the form isn't submitted but error message is not displayed.

Here is my code in the controller:
RecaptchaVerificationHelper recaptchaHelper = this.GetRecaptchaVerificationHelper();

            if (String.IsNullOrEmpty(recaptchaHelper.Response))
            {
                ModelState.AddModelError("", Resources.CaptchaEmpty);
                return View(model);
            }

            RecaptchaVerificationResult recaptchaResult = recaptchaHelper.VerifyRecaptchaResponse();

            if (recaptchaResult != RecaptchaVerificationResult.Success)
            {
                ModelState.AddModelError("", Resources.ContactsCaptchaError);
            }