menu

秋梦无痕

一场秋雨无梦痕,春夜清风冻煞人。冬来冷水寒似铁,夏至京北蟑满城。

Avatar

在ASP.NET中清空浏览器客户端的缓存

from 沉思辣椒@博客堂:

/// <summary>
/// 清空浏览器客户端的缓存
/// </summary>
public static void ClearClientPageCache() {
HttpContext.Current.Response.Buffer=true;
HttpContext.Current.Response.Expires = 0;
HttpContext.Current.Response.ExpiresAbsolute=DateTime.Now.AddDays(-1);
HttpContext.Current.Response.AddHeader("pragma","no-cache");
HttpContext.Current.Response.AddHeader("cache-control","private");
HttpContext.Current.Response.CacheControl="no-cache";
}

好像这样不行的..........

呃。。。这个文章很老了,04年的。

建议你了解一下客户端清理缓存的机制,实现起来应该不难的。

评论已关闭