Monday, March 21, 2011

How to disable the cache for back button functionality.

Response.CacheControl = "no-cache";
Response.AddHeader("Pragma", "no-cache");
Response.Expires = -1;

HttpContext.Current.Response.Cache.SetAllowResponseInBrowserHistory(false);
HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetExpires(DateTime.Now.AddSeconds(-1));
HttpContext.Current.Response.Cache.SetNoStore();

Implement the above in the master page load event and in logout functionality.

No comments:

Post a Comment