在Ajaxpost ASP.NETMVC中包含防伪造令牌
var data = { ... } // with token, key is '__RequestVerificationToken'$.ajax({
type: "POST",
data: data,
datatype: "json",
traditional: true,
contentType: "application/json; charset=utf-8",
url: myURL,
success: function (response) {
...
},
error: function (response) {
...
}
});[ValidateAntiForgeryToken]A required anti-forgery token was not supplied or was invalid.
编辑
<form id="__AjaxAntiForgeryForm" action="#" method="post"> @Html.AntiForgeryToken()</form>
杨魅力
慕丝7291255
随时随地看视频慕课网APP