IIS7 : HOW TO enable content expiration?
In IIS6, it was with the website properties --> HTTP Headers. Here in IIS7, you can do this on the "HTTP Response Headers" feature on the website.
- Select the website in the Connections pane.
- Double click on the "HTTP Response Headers" feature in the features pane
- In the action pane, click on the "Set Common Headers..."
- You will see the following popup
Now, you know what to select. You should enable the HTTP Keep-Alive on this popup only.
Happy Learning IIS7!
Comments
Anonymous
August 06, 2009
Thanks Rakki, It was good post. But how do I set content expiration for individual files. This sets the expiration for all the files under my website. Thanks, AnandaAnonymous
August 06, 2009
@ananda - Choose the content view in the IIS manager. Select the file which you want to set, and then choose "Switch to Features View" in the actions pane. Now, go into HTTP Headers, and set the content expiration. You will see a <location path="filename.aspx"> appearing in your web.config. Or use appcmd to do the same. Hope this helps!Anonymous
September 01, 2009
Hello Rakki, Thanks for this very usefull post. In my application I would like to enable caching for a large bunch of files [all images/js etc] but not for aspx [dynamic files]. Here I have a requirement that all .png/.js/.gif should be cached by browser. By adding individual entries in web.config will be little more effort in this case. Please suggest.Anonymous
December 13, 2009
Hello Rakki, Thank you very much for this post, I have been trying to figure out where this went for hours. I'm very familiar with IIS6 but still learning IIS7. Your post was very helpful for me so big thanks to you! Best, Matt