Reputation: 111
I'm working on asp.net MVC5 with VS2013, and testing my webapp. And I found that, when I login my website with (remember me?) checked . I'll sometimes can not logoff correctly. Then I find in debug tools,that each time when I logoff, It will request a new cookie with Authentication. How should I do with this situation?
This is the code for LogOff.
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult LogOff()
{
AuthenticationManager.SignOut();
return RedirectToAction("Index", "Home");
}
This is the problem where I think:
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
filters.Add(new System.Web.Mvc.AuthorizeAttribute());
filters.Add(new HandleErrorAttribute());
}
Upvotes: 1
Views: 118
Reputation: 93434
It seems that it doesn't always clear the cookie correctly unless you use the following:
AuthenticationManager.SignOut(DefaultAuthenticationTypes.ApplicationCookie);
Upvotes: 2