views:

26

answers:

1

I'm trying to get a page to refresh when navigated to from the back button. From what I understand after reading around a bit I should just need to mark the page as uncacheable but I can't get any browsers to refresh the page. These are the headers I've currently got:

Cache-Control:no-cache
Connection:keep-alive
Content-Encoding:gzip
Content-Length:1832
Content-Type:text/html; charset=utf-8
Date:Mon, 07 Jun 2010 14:05:39 GMT
Expires:-1
Pragma:no-cache
Server:Microsoft-IIS/7.5
Vary:Accept-Encoding
Via:1.1 smoothwall:800 (squid/2.7.STABLE6)
X-AspNet-Version:2.0.50727
X-AspNetMvc-Version:2.0
X-Cache:MISS from smoothwall
X-Powered-By:ASP.NET

Why would the browser pull this page from it's browser history and not refresh it?

A: 

Figured it out. This is what I found to work:

Cache-Control:no-cache, no-store
Connection:Close
Content-Length:7683
Content-Type:text/html; charset=utf-8
Date:Wed, 09 Jun 2010 03:37:38 GMT
Expires:-1
Pragma:no-cache
Server:ASP.NET Development Server/9.0.0.0
X-AspNet-Version:2.0.50727
X-AspNetMvc-Version:2.0

achieved with the following ASP.NET code:

Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetAllowResponseInBrowserHistory(false);
Response.Cache.SetMaxAge(new TimeSpan(0));
Response.Cache.SetNoStore();
Response.Cache.SetExpires(new DateTime(1940, 1, 1));
cantabilesoftware