【发布时间】:2014-12-23 07:12:32
【问题描述】:
我使用 .NET MVC 创建了一个应用程序,但有一个似乎无法解决的错误。
当我启动我的应用程序并且您仍然从上次登录时开始登录时,您似乎已登录,但是当您单击页面时,可以说“管理仪表板”(需要您登录)它会保持加载并因超时错误而关闭。
如果我退出并重新登录,它会完全正常。
我怎样才能让你在启动应用程序时总是退出? :)
提前致谢。
使用 .NET Entity Framework 5.0.0
编辑:我尝试过 persistcookie: false 但这没有用。重新启动 mvc 应用程序后我仍然登录。 我的登录操作代码在 accountcontroller 中:
[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public ActionResult Login(LoginModel model, string returnUrl)
{
if (ModelState.IsValid && WebSecurity.Login(model.UserName, model.Password, persistCookie: model.RememberMe))
{
if (returnUrl == null)
{
return RedirectToAction("Index", "Home");
}
else
{
return Redirect(Server.UrlDecode(returnUrl));
}
}
// If we got this far, something failed, redisplay form
ModelState.AddModelError("", "The user name or password provided is incorrect.");
return View(model);
}
【问题讨论】:
标签: .net authentication model-view-controller login authorize