Files that the browser retrieves from the server should be stored in the browser’s cache as long as possible to help minimize server round-trips.

  • But how does IIS knows what is actually a static content and what is not?

    Is it just images , css , js and not ASPX , ashx...?

    Where can I see in the IIS what is already considered to be static and what not ?

  • And what about the scneraio where a page has been declared with <%@ OutputCache header(without location) . does the images,css,js src files inside of it , are also being output cached ?

  • As a best prcatice , I should set one year into the future as the maximum expiration time.I should use that as the default for all static content on the site

So I did this :

enter image description here

But later , after pressing OK , I can't find any summary menu which shows me : to whom I already put a response header(in this case : the css folder).

Currently , in order to see that css folder has been applied with respose headers - I have to go to the css folder again --> Http Response Header-->Set Common Headers--> and then I see it. It doesn't written in the web.config.

But if I do it for a file (Login.aspxfor example): I do see it in web.config :

    <location path="Login.aspx">
                <clientCache cacheControlMode="UseExpires" cacheControlMaxAge="1.00:00:00" httpExpires="Fri, 15 Feb 2013 00:00:00 GMT" />

Press Windows+R and paste:

notepad %systemroot%\System32\inetsrv\config\applicationHost.config

this will bring up the main configuration file for IIS:

Most changes you are making in the IIS UI that don't make it into your web.config are saved here.

Towards the end is a 'handlers' node that defines how the various file types are handled, all extensions that are not listed in the path attributes, are considered static files and are handled by the very last entry: 'name="StaticFile" '

Your changes to the caching will be further up in 'sites' or inside a 'location' node.

Don't make changes to this file directly, thanks to UAC you wont be able to anyways.

How to choose your caching strategy, depends on your content. Can you really be sure certain resources wont change for a year?

The OutputCache directive is for the page itself, any linked content is requested by the client independently so you have to set the caching for them as well.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.