What is the best way to add "Expires" in http header for static content? eg. images, css, js
The web server is IIS 6.0; the language is classical ASP
What is the best way to add "Expires" in http header for static content? eg. images, css, js
The web server is IIS 6.0; the language is classical ASP
I don't know if this is what you are looking for, but it does keep my pages from being cached.
I got these from an article on line that I no longer have a reference for.
in IIS admin you can set it for each file type or you can (for dynamic ones like aspx) do it in the code. After you have it setup you need to check the headers that are output with a tool like Mozilla firefox + live headers plugin - or you can use a web based tool like http://www.httpviewer.net/
For others coming from google: this will not work in iis6 but works in 7 and above.
In your web.config:
Terrible solution, the first command to create with adsutil will fail with error -2147024713 (0x800700B7) since the files your trying to create already exists.
Thanks.
I think this is what you're after, It's Content Expiration under HTTP Headers in IIS Manager. I use the pattern of sticking static content under a folder like ~/Resources and setting the expiration on that particular folder to have a much longer life than the rest of the application.
Here's a link to the full article: IIS 6.0 F1: Web Site Properties - HTTP Headers Tab
You could try something like this:
Which sets the caching value for each CSS file in a web root to 5 days, then run it like this:
Kind of painful, but workable.
BTW - to get the value for HttpExpires, set the value in the GUI, then run
to get the actual value you need