How can we clear Cache stored in browser ?

 Posted by Chvrsri on 7/6/2011 | Category: C# Interview questions | Views: 5230 | Points: 40
Answer:

Below mentioned code is useful to clear the Cache stored in the Browser.


Response.ExpiresAbsolute = DateTime.Now;
Response.Expires = -1441;
Response.CacheControl = "no-cache";
Response.AddHeader("Pragma", "no-cache");
Response.AddHeader("Pragma", "no-store");
Response.AddHeader("cache-control", "no-cache");
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetNoServerCaching();


Note


This code is useful only when the caching is done in the server.


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response