<%
Response.Buffer = true;
Response.ExpiresAbsolute = DateTime.Now - new TimeSpan(1, 0, 0);
Response.Expires = 0;
Response.CacheControl = "no-cache";
%>
这种方法非常有效!它强制浏览器重新访问服务器下载页面,而不是从缓存读取页面。使用这种方法时,编程者的主要任务是创建一个会话级的变量,通过这个变量确定用户是否仍旧可以查看那个不适合通过后退按钮访问的页面。由于浏览器不再缓存这个页面,当用户点击后退按钮时浏览器将重新下载该页面,此时程序就可以检查那个会话变量,看看是否应该允许用户打开这个页面。
2、在<head></head>中加入
<meta http-equiv="pragma" content="no-cache">
另一位网友这样说:
在<head></head>中插入
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-store, no-cache, max-age=0, must-revalidate">
3、后台添加
Response.Cache.SetNoStore();
你的代码加到Page_Load就可以
4、代码
Response.ExpiresAbsolute = DateTime.Now - new TimeSpan(1, 0, 0);
你的代码加到Page_Load就可以
5。
如何禁止浏览器缓存某一页面? | ||
|