ram*_*ram 6 asp.net iis caching http-headers
我想不在任何地方缓存我的aspx页面.出于某种原因,IE忽略了从我的母版页设置的元标记
<meta http-equiv="Expires" CONTENT="0">
<meta http-equiv="Cache-Control" CONTENT="no-cache">
<meta http-equiv="Pragma" CONTENT="no-cache">
Run Code Online (Sandbox Code Playgroud)
我试图看看我是否可以将我的Http响应头设置为"Cache-Control" - "no-cache".设置类似的东西
HttpContext.Current.Response.Headers.Add("Cache-Control", "no-cache");
HttpContext.Current.Response.Headers.Add("Exipres", DateTime.Now.AddDays(-1).ToShortDateString());
Run Code Online (Sandbox Code Playgroud)
在每一页都会很痛苦.我在想,无论如何我们都可以在IIS7中设置它(将此标题添加到aspx页面,但不是image/css/js).可能吗 ?
编辑:根据http://technet.microsoft.com/en-us/library/cc753133%28WS.10%29.aspx中的建议,添加自定义http响应标头会将标头添加到所有文件,包括js,css,images .所以在这里添加"Cache-Control","no-cache"也不起作用
Edit2:我正在考虑添加一个httpmodule.类似于http://blogs.technet.com/stefan_gossner/archive/2008/03/12/iis-7-how-to-send-a-custom-server-http-header.aspx.有什么建议 ?
http://technet.microsoft.com/en-us/library/cc770661(WS.10).aspx
默认情况下,IIS 仅缓存静态内容;如果它已经缓存非静态内容,您将必须进行调整。
| 归档时间: |
|
| 查看次数: |
35129 次 |
| 最近记录: |