【发布时间】:2015-12-25 07:13:45
【问题描述】:
在我的 MVC5 应用程序中,实现了防伪令牌。当用户启动并登录时,它可以工作。如果用户在登录后单击浏览器并使用不同的凭据重新提交,则会显示
The provided anti-forgery token was meant for user "xxxx", but the current user is "yyyy"
在登录控制器中,我尝试过类似
public ActionResult Index()
{
if (User != null && (User.Identity.IsAuthenticated || User.Identity.Name != ""))
{
FormsAuthentication.SignOut();
Session.Abandon();
return RedirectToAction("Index");
}
return View();
}
但在这种情况下,系统不会触发该操作。
【问题讨论】:
-
您能解释一下“启动和登录”是什么意思吗?
-
启动应用程序并登录系统
标签: c# login asp.net-mvc-5 form-submit antiforgerytoken