给梦一个奔跑的方向!
PDF Print E-mail
User Rating: / 1
PoorBest 
Written by xlingfairy
Saturday, 10 October 2009 17:24
 //Response.Expires = -1;
//Response.ExpiresAbsolute = DateTime.Now.AddMinutes(-1);
//Response.CacheControl = "no-cache";
//Response.AddHeader("Pragma", "no-cache");
Response.Cache.SetNoStore();
Response.Cache.SetAllowResponseInBrowserHistory(false);
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetExpires(DateTime.Now.AddDays(-1));
Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches);
Response.Cache.SetValidUntilExpires(true);
Response.Cache.SetMaxAge(new TimeSpan(0));
Response.Cache.SetAllowResponseInBrowserHistory(false);
Response.Cache.AppendCacheExtension("post-check=0,pre-check=0");
 
我都加了一堆这东西,按返回按钮后,验证图依然不刷新. 上面这些代码是加到验证图里的.
IE/ Chrom 下可早就OK了,但是FF 和 OP 就是不行.
下面是FF返回的 Response.header
HTTP/1.1 200 OK
Server: ASP.NET Development Server/9.0.0.0
Date: Sat, 10 Oct 2009 08:37:12 GMT
X-AspNet-Version: 2.0.50727
Cache-Control: no-cache, no-store, must-revalidate, post-check=0,pre-check=0
Pragma: no-cache
Expires: -1
Content-Type: image/gif
Content-Length: 6248
Connection: Close
 
当然,用JS很简单的就把这个问题处理了,但是, 能不用JS的就不要用JS.
 
下面是MOZ官方对 FF Caching 的解释:
https://developer.mozilla.org/en/Using_Firefox_1.5_caching
 
用了一个叫 : Back-Forward Cache (bfcache) 的技术, 把 页面内容包括 JS的执行状态都放到内存里了,按回退按钮的时候, JS 都是以经执行过的(没有验证,原来好像遇到过这样的问题)
 
也给出了N种不会被 bfcache 的情况,前三个:
 
the page uses an unload handler 
the page sets "cache-control: no-store" 
the page sets "cache-control: no-cache" and the site is HTTPS. 
 
第二,三 条我都设了,没有反应.
第一条 有待验证.
 

Add comment


Security code
Refresh

Popular Contents

Recommend

Site Info

Members : 1
Content : 130
Web Links : 7
Content View Hits : 99625

Links