Expires headers in ASP MVC Development Server

609 views Asked by At

I am currently changing from LABjs to YepNope, and as part of this change YepNope requires that the static content files have an "expires" header set with an absolute date/time.

I am currently using VS2010 with .net 4 and ASP MVC 3, and have tried putting the staticContent section in the web.config:

<staticContent>
  <clientCache cacheControlCustom="public" httpExpires="Sun, 1 Mar 2020 00:00:00 GMT" cacheControlMode="UseExpires" />
</staticContent>

However it never pumps out the header... should I just use a HttpHandler and set that up in the web config to route all static content folders to this and add the headers in code?

1

There are 1 answers

0
covo On BEST ANSWER

If you are hosting your site on IIS, you could use the built in Output Caching functionality. It will assure your content has an expiration.

If you are not familiar with it, here is a good walk-through: http://learn.iis.net/page.aspx/710/configure-iis-7-output-caching/

Hope this helps, -covo