IIS7:设置"无缓存"所有aspx页面而不是图像/ CSS / JS [英] IIS7: set "no-cache" for all aspx pages but not images/css/js

查看:742
本文介绍了IIS7:设置"无缓存"所有aspx页面而不是图像/ CSS / JS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想不随地缓存我aspx页面。出于某种原因,IE浏览器会忽略这是从我的母版页设置meta标签

I would like to not cache my aspx pages anywhere. For some reason IE ignores meta tags which are set from my master page

<meta http-equiv="Expires" CONTENT="0">
<meta http-equiv="Cache-Control" CONTENT="no-cache">
<meta http-equiv="Pragma" CONTENT="no-cache">

我想看看我是否可以将我的HTTP响应头缓存控制 - 无缓存。设置类似

I am trying to see if I can set my Http response header to "Cache-Control" - "no-cache". Setting something like

HttpContext.Current.Response.Headers.Add("Cache-Control", "no-cache");
   HttpContext.Current.Response.Headers.Add("Exipres", DateTime.Now.AddDays(-1).ToShortDateString());

在每一页都将是痛苦的。我在想,如果有无论如何我们可以设置这IIS7(添加此头ASPX页面,而不是图像/ CSS / JS)。这可能吗?

in every page would be painful. I am thinking if there is anyway we can set this in IIS7 (add this header to aspx pages, but not images/css/js). Is it possible ?

编辑:按照建议在<一个href=\"http://technet.microsoft.com/en-us/library/cc753133%28WS.10%29.aspx\">http://technet.microsoft.com/en-us/library/cc753133%28WS.10%29.aspx,添加自定义HTTP响应头添加头,包括JS,CSS,图像中的所有文件。因此,加入缓存控制,无缓存在这里没有工作,要么

As per suggestion in http://technet.microsoft.com/en-us/library/cc753133%28WS.10%29.aspx, adding a custom http response header adds the header to all files including js,css,images. So adding "Cache-Control","no-cache" here did not work either

EDIT2:我正在考虑增加一个HTTP模块。类似的东西,以<一个href=\"http://blogs.technet.com/stefan_gossner/archive/2008/03/12/iis-7-how-to-send-a-custom-server-http-header.aspx\">http://blogs.technet.com/stefan_gossner/archive/2008/03/12/iis-7-how-to-send-a-custom-server-http-header.aspx.有什么建议?

I am thinking about adding a httpmodule . Something similar to http://blogs.technet.com/stefan_gossner/archive/2008/03/12/iis-7-how-to-send-a-custom-server-http-header.aspx. Any suggestions ?

推荐答案

http://technet.microsoft.com/en-us/library/cc770661(WS.10)的.aspx

在默认情况下只有IIS缓存静态内容;你将不得不做出调整,如果它已经缓存非静态内容。

By default IIS only caches static content; you'll have to make adjustments if it's caching non-static content already.

这篇关于IIS7:设置&QUOT;无缓存&QUOT;所有aspx页面而不是图像/ CSS / JS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆