易腾动力社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 7054|回复: 0
打印 上一主题 下一主题

asp清缓存

[复制链接]
跳转到指定楼层
楼主
发表于 2013-7-3 22:41:16 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
有时候缓存会给程序带来很大的麻烦,这段代码是用来清空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);

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|易腾动力 ( 粤ICP备12094338号 )

GMT+8, 2025-5-4 17:52 , Processed in 0.049802 second(s), 17 queries .

Powered by Discuz! X3

© 2001-2024 Yidz Inc.

快速回复 返回顶部 返回列表