缓存的静态内容的到期日期 [英] Expiration date for Cached static content
问题描述
我使用asp.net c#4和IIS 7.5。
我需要在我的网站上为我的静态内容设置标题,以缓存PUBLIC 14天。 / p>
目前我在web.config中使用此设置
< staticContent>
< clientCache cacheControlMode =UseMaxAgecacheControlMaxAge =14.00:00:00/>
< / staticContent>
结果我得到一个头 Cache-Control:max-age = 1209600
我使用 https://developers.google.com/pagespeed/ ,我仍然收到一个(未指定到期日)
我的web.config文件中缺少的是我们输出的Expires属性?
谢谢
<在HTTP 1.1中不推荐使用ExpiresHTTP标头 - 这只是旧的HTTP 1.0客户端所需要的(或者为了满足不了解任何更好的工具) 。
如果你真的想要它,你可以创建一个简单的HttpModule来标识对静态内容和调用的请求:
Response.Cache.SetExpires()
I use asp.net c# 4 and IIS 7.5.
I need to set the header for my static content on my website for caching PUBLIC for 14 days.
At the moment I use this setting in my web.config
<staticContent>
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="14.00:00:00" />
</staticContent>
As result I get a header Cache-Control:max-age=1209600
I'm testing my site with https://developers.google.com/pagespeed/ and I still get an (expiration not specified)
What I missing in my web.config to get the "Expires" attributes us output?
Thanks
The "Expires" HTTP header was deprecated in HTTP 1.1 -- it's only needed by old HTTP 1.0 clients (or to satisfy tools that don't know any better).
If you really want it, you could create a simple HttpModule that identifies requests for static content and calls:
Response.Cache.SetExpires()
这篇关于缓存的静态内容的到期日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!