Reputation: 57469
I have a logout action which directs to a logout view. The user information is still displayed after clicking the logout button. I fully logout after I go to a different url, why is this? How do I handle this? Client-side redirect?
Action:
public ViewResult LogOut()
{
FormsAuthentication.SignOut();
return View();
}
Upvotes: 3
Views: 399
Reputation: 735
Try getting rid of the authentication token:
FormsAuthentication.SignOut();
Context.Response.Cookies.Item(FormsAuthentication.FormsCookieName).Expires = Date.Now;
return RedirectToAction("LogOut");
Also, make sure the page is not cached:
Response.Cache.SetExpires(DateTime.UtcNow.AddMinutes(-1));
Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.Cache.SetNoStore();
Upvotes: 2