所需的防伪cookie "__RequestVerificationToken“不存在。
我还在cshtml和Controller中添加了
using (Html.BeginForm())
{
@Html.AntiForgeryToken()
//some code
}
[HttpGet]
[ValidateAntiForgeryToken]
public ActionResult Index()
{
using (var db = new SampleEntities())
{
return View(db.Rfps.ToList());
}
}
发布于 2014-11-05 22:13:24
这个问题是因为您在GET请求上使用了ValidateAntiForgeryToken
属性。您不需要将此属性用于GET
操作。有关更多信息,请查看here:
发布于 2015-03-01 03:56:40
在我的例子中,我的web.config中有以下内容:
<httpCookies requireSSL="true" />
但是我的项目被设置为不使用SSL。注释掉这一行或将项目设置为始终使用SSL解决了这个问题。
发布于 2017-06-16 21:00:13
在我的例子中,这是因为我之前运行过另一个Asp.Net网站。因此cookie不能与localhost匹配。我清理了我的cookies (只用于localhost),现在一切都好了。
https://stackoverflow.com/questions/26759102
复制相似问题