退房在這個問題的回答:
Best way to disable client caching
這是同樣的問題,同樣的公關會議(IE工作,FF不)和一個可接受的解決方案。我引用:
Expires: Sun, 19 Nov 1978 05:00:00 GMT
Last-Modified: Fri, 12 Jun 2009 08:01:46 GMT (the actual modification date)
Cache-Control: store, no-cache, must-revalidate, post-check=0, pre-check=0
編輯:
您可以在頁面的代碼隱藏設置的前兩個標題是這樣的:
this.Response.Cache.SetExpires(DateTime.Now);
this.Response.Cache.SetLastModified(DateTime.Now);
但實際上,它應該是足夠的做以下來禁用緩存(另請參閱Whats the best way to deal with pages loaded via browser history in asp .net?):
this.Response.Cache.SetCacheability(HttpCacheability.NoCache);
this.Response.Cache.SetNoStore();
這會生成以下標題:
Cache-Control: no-cache, no-store
Pragma: no-cache
Expires: -1
我正在更正標題,所以這不會得到不必要的迴應票,因爲您之後的無緩存完全有效......只是「禁用後退按鈕」因爲很好的理由,我會發現自己會皺起眉頭:)但這與你在這裏之後的不同。 – 2010-05-29 14:16:33