ASP.Net MVC 5 w/identity 2.2.0 注销不起作用
问题描述:
我在测试 ASP.Net MVC 5 站点(用于 Internet 站点)上使用基本登录.
I am using a the basic login on a test ASP.Net MVC 5 site (for an internet site).
登录工作正常,但当我尝试注销时却没有发生.注销链接确实调用了以下控制器操作:
The login works fine but when I try to logout it doesn't happen. The logout link does call the following controller action:
public ActionResult LogOff()
{
AuthenticationManager.SignOut();
return RedirectToAction("Index", "Home");
}
但用户保持登录状态.我如何确保用户实际已注销?
But the user stays logged in. How do I ensure that the user actually gets logged out?
答
我之前也遇到过这个问题,改一下:
I had this problem before, change:
AuthenticationManager.SignOut();
致:
AuthenticationManager.SignOut(DefaultAuthenticationTypes.ApplicationCookie);
假设您使用 ApplicationCookie 来存储您的登录信息.
Assuming that you are using ApplicationCookie to store your login information.