views:

37

answers:

1

I have a website which currently allows caching of its images, however, there was a decision to no longer allow caching. So I proceded to add cache-control and Expires headers to the response header.

I noticed however that IE still sends out a conditional request on the images and the server responds with a 304 response. In the 304 response, I see the updated cache-control and Expires headers, but IE continues to use the images from the cache. No matter how many times I refresh or open and close the browser it still uses the cached images. Only after I clear the cache folder will IE finally listen to the cache control headers.

I was wondering if someone could explain this behaviour in IE for me. Is this an IE qurk or I not understanding something about cache control. Thanks,

Note: When I mentioned that the website allowed caching of images, this was done by not providing any Cache-control or Expire headers at all. Only a ETag header was used.

A: 

You will need to set the max-age headers for your images. You can set it at the IIS level or in the web.config.

There is a good article on it at:

http://www.stardeveloper.com/articles/expires-and-max-age-headers-in-aspnet/

Jason Jong