Search This Blog

Saturday, August 28, 2010

Logout Button - Avoid Back Button

we sometime face problem of back button that after logout then if we click back button then we able access those pages those already visited and that page always require login Session so if click on button go to login page.Here i will give the code even if you click back button after logout you will remain in same page after you click back button.
if you click logout button go to login page and then click back button you will be same login page if you use this code.Use this code onclick of logout button.
logout button
--------------------
Session.clear();//clear session
Session.Abandon();//Abandon session
Response.Cache.SetExpires(DateTime.UtcNow.AddMinutes(-1));
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetNoStore();Response.Redirect("Logout.aspx");

Add Page Load with postback
--------------------------------
Response.Buffer = true;
Response.ExpiresAbsolute = DateTime.Now.AddDays(-1d);
Response.Expires = -1500;
Response.CacheControl = "no-cache";


2.IE-Browser Head Tag
apply head tag
----------------
<meta http-equiv="Page-Enter" content="blendTrans(Duration=1.5)" />

No comments:

Post a Comment