【发布时间】:2015-01-14 17:35:56
【问题描述】:
提供的防伪令牌用于用户“”,但当前用户是“xxxx”。
我已遵循所有可能的解决方案来消除此错误,但没有成功:
这是场景: 我在浏览器选项卡 A 选项卡 B 中打开了 2 个单独的登录选项卡: 1. 我在 Tab A 中登录我的网站 2.然后尝试登录Tab B
然后出现上述错误
我的 C# web MVC 登录视图有:
v class="col-md-4 col-md-offset-4">
<form class="form-signin" role="form" action=@Url.Action("Login", "Account") method="POST" id="signInForm">
@Html.AntiForgeryToken()
<div class="form-group">
<label for="loginEmail">Email</label>
<input type="text" id="loginEmail" name="loginEmail" class="form-control" placeholder="Email address" >
</div>
<div class="form-group">
<label for="loginPassword">Password</label>
<input id="loginPassword" type="password" name="loginPassword" class="form-control" placeholder="Password" >
</div>
<button class="btn btn-lg btn-primary btn-block main-btn" type="submit">Sign in</button>
<div>
<br>
<a href="@Url.Action("Index","GettingStarted")">Register</a><br>
<a href="@Url.Action("ForgotPassword","Account")">Forgot your password?</a>
</div>
</form>
我的帐户控制器是这样的:
[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public ActionResult Login(LoginModel model)
{
if (ModelState.IsValid)
{
我该如何解决这个错误?
【问题讨论】:
-
它不在——至少不在我的窗口中(也刷新了)
-
这在现实世界中什么时候会成为一个问题(这意味着一个人最终如何尝试从两个选项卡登录两次到同一个站点)?一旦你在 Tab A 上登录,你就在 Tab B 上登录,只需刷新页面...
标签: c# asp.net-mvc