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";
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";
博客给出了一段代码用于控制HTTP响应缓存。通过设置响应缓冲区、过期时间,添加特定头部信息,如pragma、cache - control等,将缓存控制设置为不缓存。
2345

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



