The sessions are not alived; they are just cached.
You can try to force refresh your page (ctrl+f5) and check this.
if you're using forms authentication then this is what you are looking for...
public ActionResult LogOut()
{
Session.Clear();
FormsAuthentication.SignOut();
Redirect("http://AnotherApplicaton/Home/LogOut");
}
hth
Hi got the solution. Actually I have used toke to login into my module and the token timeout was 5 second. If I Logged out and click on the back button of the browser before the 5 second then the Session_Start() event of glowal.ascx.cs is called again and read the token again and the create the session again. And if I click on the back button after the 5 second then session does not create. To solve this problem I does not allow the user to go to back through the browser. For this I have used the following code
<script type="text/javascript">
history.go(1);
</script>
The pages you visit in your browser are cached depending upon your caching settings in the browser. You need to prevent caching in ASP.net MVC so that they are not cached by the browser. After you do that try clearing your browsers cache and try loading the page again. Logout and try the back button. You should get a message saying that the page no longer exists or something.
There are many ways of preventing your ASP.net pages from getting cached in the browser. One such way is to do this before the page is rendered.
this.Response.Cache.SetExpires(DateTime.UtcNow.AddMinutes(-1))
this.Response.Cache.SetCacheability(HttpCacheability.NoCache)
this.Response.Cache.SetNoStore()