私は 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」がサーバーに送信されたことをfirebugで確認できますが、それでもエラーが発生します
[NullReferenceException: オブジェクト参照がオブジェクトのインスタンスに設定されていません。]
g:\CodePlex\Captcha\CaptchaMvc(Mvc 3)\Infrastructure\DefaultCaptchaManager.cs:435 の CaptchaMvc.Infrastructure.DefaultCaptchaManager.ValidateCaptcha(ControllerBase コントローラー、IParameterContainer parameterContainer)
そして、次の行がある場合に発生します:
[CaptchaMvc.Attributes.CaptchaVerify("Captcha is not valid")]
コントローラーアクションで、そうでない場合、エラーはありませんが、キャプチャは検証されません。何をすべきか ?