I have an ASP.NET web project that (among other things) is serving some static files. By default, the framework assumes that all file paths are relative to the location of the web project. However, I'd like the actual root to be loaded from a custom setting in Web.config (e.g. "C:\MyStaticFiles\"
).
Is there any way to change what StaticFileHandler
considers to be the server root directory?
If not, is there an easy way to implement IHttpHandler
that will make this change and hand off the rest of the work to the regular StaticFileHandler
?
I think, from performance reasons, it isn't good idea to create different path mapping for static resources. They can be served by IIS directly without any ASP.NET processing if the are located in web site folder.