''''''''''''''''''''''''''''''''''''''''ASP 脚本
Response.Buffer = True
Response.ExpiresAbsolute = Now() - 1
Response.Expires = 0
Response.CacheControl = "no-cache"
////////////////////////////////////////ASP.NET 脚本
复制代码 代码如下:
Response.Buffer=true;
Response.ExpiresAbsolute=DateTime.Now.AddSeconds(-1);
Response.Expires=0;
Response.CacheControl="no-cache";
ASP禁用缓存补充:
Response.ExpiresAbsolute =Now() - 1
Response.Expires=0
Response.CacheControl="no-cache"
ajax强制不缓存的方法
1、加个随机数
xmlHttp.open("GET", "ajax.asp?now=" + new Date().getTime(), true);
2、在要异步获取的asp页面中写一段禁止缓存的代码:
Response.Buffer =True
Response.ExpiresAbsolute =Now() - 1
Response.Expires=0
Response.CacheControl="no-cache"
3、在ajax发送请求前加上xmlHTTP.setRequestHeader("If-Modified-Since","0");可以禁止缓存
xmlHTTP.open("get", URL, true);
xmlHTTP.onreadystatechange = callHTML;
xmlHTTP.setRequestHeader("If-Modified-Since","0");
xmlHTTP.send();
4、header(”Cache-Control: no-cache, must-revalidate”);