Response.Buffer = True Response.ExpiresAbsolute = Now() - 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="****.asp?random()"
前两个要领听说有时会失效,而第三种则是在跳转时传一个随机的参数! 由于aspx的缓存是与参数相干的,假如参数差别就不会运用缓存,而会从新生成页面,每次都传一个随机的参数就能够防备运用缓存。这个仅适用于asp&asp.net
4、window.location.replace("WebForm1.aspx");
参数就是你要掩盖的页面,replace的道理就是用当前页面替代掉replace参数指定的页面。
如许能够防备用户点击back键。运用的是javascript剧本,举例以下:
a.html
<html> <head> <title>a</title> <script language="javascript"> function jump(){ window.location.replace("b.html"); } </script> </head> <body> <a href="javascript:jump()">b</a> </body> </html>
前3种只是清空了cache,即存储在Temporary Internet Files文件夹中的临时文件,而第4种则是运用跳转页面文件替代当前页面文件,并没有清空cache,也就是说Temporary Internet Files产生了相干的临时文件。
更多Asp.net禁用页面缓存的要领总结相干文章请关注ki4网!