设置缓存控制头

时间:2011-07-08 13:30:18

标签: asp.net meta-tags

我必须将cache-control标头设置为“no-cache,no-store”。对于我正在使用的 html元标记

<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate"/>
<meta http-equiv="Pragma" content="no-cache"/>
<meta http-equiv="Expires" content="0"/>

在网页的标签中。 我在萤火虫中检查过。尽管对所需的缓存控制具有缓存控制,但它具有“私有”。 我正在使用ASP.NET框架。 知道为什么会失败吗?

1 个答案:

答案 0 :(得分:2)

从你后面的代码

添加:

 Response.Cache.SetExpires(DateTime.UtcNow.AddMinutes(-1));
        Response.Cache.SetCacheability(HttpCacheability.NoCache);
        Response.Cache.SetNoStore();