(1) 服务端
Response.Buffer = true;
Response.ExpiresAbsolute = System.DateTime.Now.AddSeconds(-1);
Response.Expires = 0;
Response.CacheControl = "no-cache";
Response.AddHeader("Pragma", "No-Cache");
(2) 客户端
在页面的Header中加入以下代码
<meta http-equiv="pragram" content="no-cache" />
<meta http-equiv="cache-control" content="no-cache, must-revalidate" />
<meta http-equiv="expires" content="0" />
(3) 可以通过向 Web.config 文件中的 添加 enableOutputCache="false" 来对整个应用程序禁用页输出缓存。
<caching>
<outputCache
enableOutputCache="true|false"
enableFragmentCache="true|false"
sendCacheControlHeader="true|false"
omitVaryStar="true|false">
</outputCache>
</caching>
资料:http://msdn.microsoft.com/zh-cn/library/ms228124(v=vs.80).aspx
本文介绍了如何通过服务端和客户端代码以及配置Web.config文件来完全禁用网页的缓存功能,确保用户每次都能获取到最新的网页内容。
126

被折叠的 条评论
为什么被折叠?



