I was working on a site recently where I had to work on a CSS page. For some reason, my changes to the CSS were not being reflected in my browser. Of course I had set up my browser to fetch the page for every request, I had even cleared my cache, but I could not for the life of me get the page to reflect the new CSS. I had not had this issue with other file types, so I was a bit loss. On a whim, I went into the IIS Admin, and found the "Enable Content Expiration" field under the HTTP Headers tab. I set it to Expire Immidiately and suddenly things starting working. I'm assuming this is something you would not change on a production system.
(This post is more than 2 years old.)
Caching in IIS
Support this Content!
If you like this content, please consider supporting me. You can become a Patron, visit my Amazon wishlist, or buy me a coffee! Any support helps!
Want to get a copy of every new post? Use the form below to sign up for my newsletter.
Archived Comments
See this post on Scott Hanselman''s blog:
http://radio.weblogs.com/01...
Ray,
What version of IIS was this?
Jim
test
<h2>hello</h2>
The same one that ships with Windows 2k... that''s 4 I believe.
I think this is a setting I've had hassles with on a server that I don't manage. For some reason, when it's set IIS seems to expire content only based on the timer, it's not smart enough to notice that the file changed and that it should refresh its cache... at least that's how it used to behave.
Drove me crazy when I first set up ASP on an interland site a few years back. Haven't had the problem lately so perhaps they changed it.
An alternative for a productive server may be to add a querystring to your css/js file URL, like explained below:
http://it-things.com/index....