Disabling browser caching for all browsers from ASP.NET?

This is what we use in ASP. NET: Stop Caching in IE Response.Cache. SetCacheability(System.Web.

HttpCacheability. NoCache); // Stop Caching in Firefox Response.Cache.SetNoStore() It stops caching in Firefox and IE, but we haven't tried other browsers. The following response headers are added by these statements: Cache-Control: no-cache, no-store Pragma: no-cache.

This is what we use in ASP. NET: // Stop Caching in IE Response.Cache. SetCacheability(System.Web.

HttpCacheability. NoCache); // Stop Caching in Firefox Response.Cache.SetNoStore(); It stops caching in Firefox and IE, but we haven't tried other browsers. The following response headers are added by these statements: Cache-Control: no-cache, no-store Pragma: no-cache.

1 .. Thanks for your suggestion – Kyaw Thurein Feb 1 at 3:01.

For what it's worth, I just had to handle this in my ASP. NET MVC 3 application. Here is the code block I used in the Global.

Asax file to handle this for all requests. Protected void Application_BeginRequest() { //NOTE: Stopping IE from being a caching whore HttpContext.Current.Response.Cache. SetAllowResponseInBrowser HttpContext.Current.Response.Cache.

SetCacheability(HttpCacheability. NoCache); HttpContext.Current.Response.Cache.SetNoStore(); Response.Cache. SetExpires(DateTime.

Now); Response.Cache. SetValidUntilExpires(true); }.

The HttpContext.Current.Response.Cache. SetAllowResponseInBrowserstory(false) made the difference to prevent caching in bith IE and FireFox – Michael Kniskern Jun 7 at 22:43.

There are two approaches that I know of. The first is to tell the browser not to cache the page. Setting the Response to no cache takes care of that, however as you suspect the browser will often ignore this directive.

The other approach is to set the date time of your response to a point in the future. I believe all browsers will correct this to the current time when they add the page to the cache, but it will show the page as newer when the comparison is made. I believe there may be some cases where a comparison is not made.

I am not sure of the details and they change with each new browser release. Final note I have had better luck with pages that "refresh" themselves (another response directive). The refresh seems less likely to come from the cache.

Hope that helps.

The first is to tell the browser not to cache the page. Setting the Response to no cache takes care of that, however as you suspect the browser will often ignore this directive. The other approach is to set the date time of your response to a point in the future.

I believe all browsers will correct this to the current time when they add the page to the cache, but it will show the page as newer when the comparison is made. I believe there may be some cases where a comparison is not made. I am not sure of the details and they change with each new browser release.

Final note I have had better luck with pages that "refresh" themselves (another response directive). The refresh seems less likely to come from the cache.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions