ASP.NET和ASP程序防止在IE中进行缓存

ASP程序方法:

通过 Microsoft Internet Information Server (IIS),您可以在特定 Active Server Pages (ASP) 页的最开始位置,使用以下脚本代码方便地标记高度易变页或敏感页:

<%
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>

posted @ 2010-03-25 04:28  IT鸟  阅读(239)  评论(0编辑  收藏  举报