Caching in IIS

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.

Archived Comments

Comment 1 by seancorfield posted on 6/18/2003 at 2:56 AM

See this post on Scott Hanselman''s blog:
http://radio.weblogs.com/01...

Comment 2 by Jim posted on 6/24/2003 at 5:43 AM

Ray,
What version of IIS was this?
Jim

Comment 3 by evila posted on 6/28/2003 at 9:07 AM

test

Comment 4 by evila posted on 6/28/2003 at 9:07 AM

<h2>hello</h2>

Comment 5 by Raymond Camden posted on 6/30/2003 at 3:52 PM

The same one that ships with Windows 2k... that''s 4 I believe.

Comment 6 by Jeff Wilkinson posted on 1/16/2004 at 9:34 PM

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.

Comment 7 by Joao Pinto posted on 8/25/2010 at 9:55 PM

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....