清空IE缓存里内容的ASP代码 [ 网站地图 ]

发表于:2010-5-5 浏览:399 作者: 来源:站长资讯网

关键字:IE,缓存,ASP,代码

描述:有时候缓存会给程序带来很大的麻烦,这段代码是用来清空IE缓存里的内容 1.禁止客户端缓存要在<head>中加入类似如下内): <METAHTTP-EQUIV="pragma"CONTENT="no-cache"><METAHTTP

有时候缓存会给程序带来很大的麻烦,这段代码是用来清空IE缓存里的内容

1.禁止客户端缓存要在<head>中加入类似如下内):


<META HTTP-EQUIV="pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
<META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">

2.在服务器的动态网页中禁止缓存,要加入类似如下脚本

(1)asp:


<%
Response.Expires = -1
Response.ExpiresAbsolute = Now() - 1
Response.cachecontrol = "no-cache"
%>


或者
<%
pStr = "private, no-cache, must-revalidate"
Response.ExpiresAbsolute = date()
Response.AddHeader "pragma", "no-cache"
Response.AddHeader "cache-control", pStr
%>

(2)jsp:


response.setHeader("Pragma","No-cache");
response.setHeader("Cache-Control","no-cache");
response.setDateHeader("Expires", 0);


站长资讯网 做中国最丰富的资讯网站 沪ICP备05004089号