开发者

Controlling browser caching with ASP.NET and IIS 7.5

Google PageSpeed suggests the following this for my website as a high priority.

The following cacheable resources have a short freshness lifetime. Specify an expiry of at least one week in the future for the following resources:

And suggests further reading.

I am using Windows Server 2008 r开发者_开发技巧2, .net framework 4.0, asp.net and IIS 7.5. How can I increase the cache expiry for some files?

I've tried the following web.config, but it doesn't work.

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.web>
        <sessionState mode="Off" />
    </system.web>
    <system.webServer>
        <staticContent>
          <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="10.00:00:00" />
        </staticContent>
    </system.webServer>
</configuration>


Are you sure this is not working. I just knocked up a simple page with a single image as a test. Added your config section exactly and checked in firebug.

Here are the headers.

Controlling browser caching with ASP.NET and IIS 7.5

Looks ok to me.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜