I have seen lot of questions almost similar to this. But, I haven't found an answer that will fix my problem.
I have a logout button and I used Session.Abandon() and Session.Clear() to clear the session. It works fine. But, whenever I hit the back button on browser the page is still showing. But, it's supposed to show the login form because the user already logged out.
Controller:
[HttpPost]
public ActionResult LogOut()
{
Session.Clear();
Session.Abandon();
return RedirectToAction("Index", "LogIn");
}
How to fix this?.Any suggestion is highly appreciated. Thanks in advance.
You can set NoCache in global.asax
protected void Application_BeginRequest()
{
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetExpires(DateTime.UtcNow.AddHours(-1));
Response.Cache.SetNoStore();
}
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