Retrieve embedded static resources (css/img/etc) using Virtual Path Provider instead of GetWebResourceUrl

288 Views Asked by At

I have an asp.net 4.0 webforms website with a CSS stylesheet which I've embedded into a separate assembly.

If I load the css using ClientScript.GetWebResourceUrl it loads, but does it with that /WebResource.axd?whateverlongstringofstuff

I was hoping that I could use a Virtual Path provider so that i can simply reference it by linking to say ~/Custom/my.css

where ~/Custom/* would go through the VPP and serve it from the embedded resource.

the reason I was doing this is I want users to be able to easily override my css by adding the actual css file in that location so it serves that one instead.

However, no matter what I try, I get a 404 on that resource url, even though in my custom ResourceResolver, the fileExists resolves to true (because it does find it in the resources assembly).

So I suspect this is because IIS is configured to serve static files (css, jpg, png, etc) directly, bypassing anything I could add to the pipeline, and the only way around this would be to have my users change their web.config or IIS settings.

Is this true? because if it is I'll abandon this and go back to the WebResource.axd, but it would really be nice if this could be done

0

There are 0 best solutions below