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();
}
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();
Try Session.Abandon(); after the logout
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With