【发布时间】:2019-01-31 15:29:54
【问题描述】:
我正在使用 mvc4 c# 并使用 CaptchaMvc 中的表单查看。
我通过 ajax 发送表单数据:
$.ajax({
url: $('#registerForm').attr("action"),
type: 'POST',
contentType: 'application/json',
dataType: 'json',
data: JSON.stringify($('#registerForm').serialize()),
beforeSend: function () {
},
success: function (result) {
//debugger;
},
error: function (event, request, settings) {
//debugger;
}
});
我可以在萤火虫上看到“CaptchaInputText”发送到服务器,但我仍然收到错误
[NullReferenceException: 对象引用未设置为 对象。]
CaptchaMvc.Infrastructure.DefaultCaptchaManager.ValidateCaptcha(ControllerBase 控制器,IParameterContainer 参数容器)在 g:\CodePlex\Captcha\CaptchaMvc(Mvc 3)\Infrastructure\DefaultCaptchaManager.cs:435
如果我有这条线,它就会发生:
[CaptchaMvc.Attributes.CaptchaVerify("Captcha is not valid")]
关于控制器动作, 如果不是,则没有错误,但验证码未得到验证。 怎么办?
【问题讨论】:
标签: ajax asp.net-mvc-4 captcha