ASP.NET和ASP程序防止在IE中進(jìn)行緩存

2010-08-28 10:49:18來源:西部e網(wǎng)作者:

ASP程序方法:

通過 Microsoft Internet Information Server (IIS),您可以在特定 Active Server Pages (ASP) 頁的最開始位置,使用以下腳本代碼方便地標(biāo)記高度易變頁或敏感頁:

<%
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
Response.Expires = -1
%>

ASP.NET程序方法:

Response.Cache.SetNoServerCaching();
Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
Response.Cache.SetNoStore();

但是用這種方法有個很大的缺陷,使用它之后,之前的所有Session都將清空

HTML程序方法是比較好的:

< HEAD>
< META HTTP-EQUIV="Pragma" CONTENT="no-cache">
< META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
< META HTTP-EQUIV="Expires" CONTENT="0">
< /HEAD>

轉(zhuǎn)載請注明出處,來源于西部E網(wǎng)。

關(guān)鍵詞:ASP.NET

贊助商鏈接: