您的位置:首页 > 编程语言 > ASP

asp.net 取消禁止缓存

2007-05-08 11:33 363 查看


1。 取消缓存

(2)客户端取消

<html>
<head>
<meta http-equiv="Expires" CONTENT="0">
<meta http-equiv="Cache-Control" CONTENT="no-cache">
<meta http-equiv="Pragma" CONTENT="no-cache">
</head>

(3)服务器具端取消:

服务器端:
Response.Buffer = true;
Response.ExpiresAbsolute = DateTime.Now.AddDays(-1);
Response.Cache.SetExpires(DateTime.Now.AddDays(-1));
Response.Expires = 0;
Response.CacheControl = "no-cache";
Response.Cache.SetNoStore();

Global里面:
protected void Application_BeginRequest(Object sender, EventArgs e)
{
HttpContext.Current.Response.Cache.SetNoStore();
}
<%@ OutPutCache Location="None"%>

页面基类:
public class PageBase : Page
{
public PageBase() {}

protected override OnLoad( EventArgs e ) {
Response.Cache.SetNoStore();
base.OnLoad();
}
}

最简单的办法 :-)
学CSDN的这个论坛,在URL后面随机的加一些没用的参数,比如:
http://xxx/xxx/xxx.jpg?p=xxx

IE是用过URL来控制缓存的,这样就解决了
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: