3

I've deployed an ASP.NET MVC app on IIS7 and Windows Server 2008.

I've read posts on here, and around the web, but can't get the darn client-side caching to work.

I'm trying to cache everything in the /Content folder. So far I've select that folder in IIS manager, and set the appropriate HTTP Response Headers (under Common Headers). I've also checked the web.config file in the /Content folder and the values there are being set.

All resources in /Content come back with this (from FireBug):

Cache-Control   no-cache, no-store, must-revalidate
Pragma        no-cache
Content-Type    image/png
Expires      -1
Last-Modified   Sun, 11 Oct 2009 19:01:40 GMT
Accept-Ranges   bytes
Etag            "f318d643a54aca1:0"
Server        Microsoft-IIS/7.0
X-Powered-By    ASP.NET
Date            Sun, 11 Oct 2009 20:40:01 GMT
Content-Length  620  

Note the Cache-Control and Expires values for this static image being requested.

The site is currently compiled in Debug (this will change), but surely that wouldn't make a difference?

Obviously I'm overlooking something, any ideas would be appreciated.

Thanks

1 Answer 1

2

If you can't get it working using the IIS admin tool, try Jeff Atwood's recommendation from this thread:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <staticContent>
      <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="7.00:00:00" />
    </staticContent>
  </system.webServer>
</configuration>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.