Alex
Alex

Reputation: 77379

ASP.NET MVC Change Response Header when Serving Javascript/CSS Files

Is there a way to automatically change the response header in ASP.NET MVC when the browser requests a Javascript or CSS file?

Basically, I want my Javascript and CSS files to be served with this set explicitly on in the response header:

Cache-Control: public

Help?

Upvotes: 0

Views: 2555

Answers (2)

David
David

Reputation: 15360

Here is an article you may find useful for adding Expires or Cache Control Header to static content in IIS.

Hope it helps.

http://www.iis.net/ConfigReference/system.webServer/staticContent/clientCache

Upvotes: 2

bluszcz
bluszcz

Reputation: 4128

If you have access to http server you can make it on http layer using some rewrite mechanism - it will be fastest way. Some hardware loadbalancer also allows this.

Upvotes: 0

Related Questions