Reputation: 2167
We are using custom VirtualPathProvider to serve files from ASP.NET-based web site. To serve static files, like images, css and scripts, we explicitly stated that StaticFileHandler should be used for files with this extension. Like this:
<add verb="GET" path="*.jpg" type="System.Web.StaticFileHandler"></add>
All of this seems logical and works except one fact - all virtual files served with this handler are coming to client with "Cache-Control: private" header. This is not what I would expect for static file.
Is there any good way to make those files cacheable?
Additional info:
Update: Looks like patch from KB947461 is included in .NET Framework 3.5 SP1. And we already have it installed.
Update 2: For now we've ended up with this HttpModule that add cache headers if current handler is StaticFileHandler. But this is definitely a crutch.
Upvotes: 4
Views: 2145
Reputation: 13306
Unbelievable that the built in one doesn't do it. This looks promising: http://code.google.com/p/talifun-web/wiki/StaticFileHandler
Upvotes: 2
Reputation: 16854
Try Active Cache in IIS, WebSite properties and Cache Tab. In my case works very well.
Upvotes: 0