Explain in detail about the folowing

Posted by Lakshmim under ASP.NET on 3/23/2015 | Points: 10 | Views : 973 | Status : [Member] | Replies : 1
Can any one clearly explain me about the following

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();




Responses

Posted by: Sheonarayan on: 3/23/2015 [Administrator] HonoraryPlatinum | Points: 25

Up
0
Down
This instructs the browser that do not cache the page that is being given to you as the response.

By default, when a browser loads a web page, it caches (saves page contents into its temp folder) the images and contents so in next request of the same page most of the page contents comes from the cache (to load the page faster) or user can browse those pages in offline mode or by clicking on browser back button.

The above settings while responding the page content to the server, we instruct the browser that do not cache any part of the page into your temp folder. So even if user click browser back button, the pages gets loaded from server not from the browser temp folder. In this case, the web page doesn't work in the offline mode.

Good for creating web pages with sensitive information. Like Banking application pages etc.

Hope this helps.

Thanks

Regards,
Sheo Narayan
http://www.dotnetfunda.com

Lakshmim, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response