且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

ASP.NET MVC 5应用程序中的AntiForgeryToken错误

更新时间:2022-11-05 21:46:41

您看到的错误消息与反伪造 cookie 有关,与令牌无关(您显示的代码将提交令牌)正确地在请求中.)

The error message you see relates to the anti-forgery cookie, not the token (the code you have shown will submit the token correctly in the request).

除了来自恶意用户的攻击或客户端上的某些导致Cookie删除的攻击之外,导致此错误的一个原因是您的web.config.cs文件包含

Other than attacks from a malicious user or something on the client causing the cookie to be deleted, one cause of this error is that your web.config.cs file includes

<httpCookies requireSSL="true" />

但是您的项目未设置为使用SSL.

but you project is not set to use SSL.