Rob Kraft's Software Development Blog

Software Development Insights

A bug in retrieving css from cache in IE7?

Posted by robkraft on September 14, 2008

I have a web site with .css files that I tried to cache for 30 days.  However, tools like Fiddler and HTTPWatch indicated that my css files were not being retrieved from the cache in IE7, but they were in Firefox.  I finally managed to get the .css files to be pulled from the IE7 browser cache by setting the Last Modified property of the .css header files.

context.Response.Cache.SetLastModified(DateTime.Now); //9/10/2008 – I added this line to SetLastModified to fix what looks like a bug in IE7. IE7 appears to request and receive css files that are cached (200) – even though it should pull them from cache. Worse – they then fail to render. By setting the LastModified (which previously had no value), the CSS now seems to load from cache, and the screen uses them to render, and it does not call back to the server.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: