刷新后退按钮上的页面需要哪些HTTP头

时间:2010-06-07 14:23:10

标签: http browser

我正在尝试从后退按钮导航到要刷新的页面。根据我的理解,阅读后我应该只需要将页面标记为不可缓存,但我无法让任何浏览器刷新页面。这些是我目前得到的标题:

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

为什么浏览器会从浏览器历史记录中提取此页面而不刷新它?

1 个答案:

答案 0 :(得分:0)

想出来。这是我发现的工作:

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

使用以下ASP.NET代码实现:

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