I have implemented my own IRouteHandler for URL routing.
For files without extension it will try to load the filename as a Page from the Pages directory with:
return (IHttpHandler) BuildManager.CreateInstanceFromVirtualPath(path, typeof(Page));
However there are also images and css files (with relative paths) that need to be translated to the correct url. I try to service those files with:
try {
HttpContext.Current.Server.Transfer(fileName);
} catch (HttpException) {
throw new HttpException(404, "file not found");
}
This works fine (in Internet Explorer), however Firefox is giving me an error:
Styles.css was not loaded because its MIME type, "text/html", is not "text/css".
Is this caused by the Server.Transfer?
What should I use to redirect the file? Response.Redirect is visible to the client.