复制代码 代码如下:

/// <summary>

/// 设置页面不被缓存

/// </summary>

private void SetPageNoCache()

{

Response.Buffer = true;

Response.ExpiresAbsolute = System.DateTime.Now.AddSeconds(-1);

Response.Expires = 0;

Response.CacheControl = “no-cache”;

Response.AppendHeader(“Pragma”, “No-Cache”);

}

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来控制缓存的,这样就解决了

您可能感兴趣的文章:

  • asp.net页面SqlCacheDependency缓存实例
  • Asp.net禁用页面缓存的方法总结
  • ASP.NET页面在IE缓存的清除办法
  • ASP.NET 4中的可扩展输出缓存(可以缓存页面/控件等)
  • asp.net 使用驻留在页面中的Cache缓存常用可定时更新的数据
  • asp.net 页面输出缓存
  • ASP.net Substitution 页面缓存而部分不缓存的实现方法
  • ASP.NET 2.0中的页面输出缓存
  • 让html页面不缓存js的实现方法
  • ASP.NET页面缓存常见的4种方式
声明:本站(华域联盟www.cnhackhy.com)所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。