Asp.net防止后退(清除页面缓存)

ASP.NET清除页面缓存
  (1) Response.Buffer = true;
  Response.ExpiresAbsolute = System.DateTime.Now.AddSeconds(-1);
  Response.Expires = 0;
  Response.CacheControl = "no-cache";
  Response.AddHeader("Pragma", "No-Cache");

  (2) HTML方法
  <HEAD>
  <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
  <META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
  <META HTTP-EQUIV="Expires" CONTENT="0">
  </HEAD>
  (3) 重新调用原页面的时候在给页面传一个参数: href="****.ASPX?random()"
 
location.replace()该方式只有在客户端里有效,在.net中通过回发调用location.replace()还是能够后退.不知道为什么.

 <a href="#" onclick="location.replace('Default7.aspx');">IE不能后退</a>

(4)IIS里面的HTTP头,可以设置立即过期

原文地址:https://www.cnblogs.com/anbylau2130/p/3101416.html