Using VirtualPathProvider for simple static files

Amrik

New Member
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:\[code\]<add verb="GET" path="*.jpg" type="System.Web.StaticFileHandler"></add>\[/code\]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:[*]Yes, it's possible to add cache header in a simple HttpModule that would add it for all ".js" files, but this is not good way.[*]I've found this post, that seems related to our problem. It refers to KB947461. But it's not clear, is this patch still not applied to the framework? Almost a year passed. And where to get it, if not.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.
 
Back
Top