对Ajax帖子的Vyacheslav Captcha验证无法正常工作

时间:2014-05-28 17:01:51

标签: asp.net-mvc captcha ajaxform

我在Razor视图中有以下代码

 @{
                var captcha = Html.Captcha("", "Enter the text you see above:", 5, "", false);
            }
            <div style="float:left;">
                @captcha
                @Html.ValidationMessage(captcha.BuildInfo.InputElementId)
            </div>

在Controller中有以下代码:

var isValidCaptcha = this.IsCaptchaValid("Captcha is not valid");
                if (!isValidCaptcha)
                {
                    validationErrorslist.Add("Captcha is not valid");
                    return new JsonResult { Data = new { IsSuccess = false, Message = validationErrorslist } };
                }

只有第一次验证工作正常,但第二次只是引用旧值。 示例:如果我提供了错误的验证码,它将显示为无效的验证码,下次如果我更正并提交页面,我仍然会收到invlid catpcha消息。

我在这里缺少的......提前感谢..

1 个答案:

答案 0 :(得分:1)

来自codeplex的这个链接解决了我的问题http://captchamvc.codeplex.com/discussions/430792

相关问题