所有日志
日期归档
心情随笔
asp清缓存
有时候缓存会给程序带来很大的麻烦,这段代码是用来清空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="0">

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);


作者:林剑坤
日期:2012/6/20 13:48:12
上一篇: rs记录集
下一篇: ASP Buffer
返回上一级