Closed nicholashead closed 3 months ago
HttpHandlers don't chain. Once the request gets set to the PipelineHander, there is nowhere else it can go. Sending 200 OK with an empty body and telling IIS to cache it probably isn't the behavior you want either.
What I suspect you'd prefer is for SassAndCoffee to play nice with MVC routes. The PathBasedHandlerRemapper doesn't. Patches to enable this are welcome.
As a workaround in the meantime, you can remove the module registration and add a custom route that sends .css files to the correct PipelineHander as a last resort, after all other routes fail to match.
Thanks for the clarification. Not sure how to make an IHttpHandler aware of MVC routes, otherwise I'd send in a patch.
But in general, it seems like telling .NET you're handling all "not real" .css requests is a bad practice. Maybe there should be a better solution for that?
Well, yes and no. IIS 6 and 7+ have different capabilities. ASP.Net 2 and 4 have different capabilities. System.Net.Routing and full on MVC2/3/4 have different capabilities. The current hack listens to all incoming requests and takes control of all .css and .js requests at the earliest stage. It's hardly ideal, but in many cases it works. You found one of the places it falls apart.
Luckily - while the default configuration doesn't work for you, the pieces are there to solve your problem. You should be able to add a route that maps to a controller that does the same work that PipelineHander does.
Unfortunately I'm slammed at the moment with other work and won't have time to fix some of these glaring bugs for months :/
Specifically this code:
It's a little arrogant to think that the PipelineHandler is the only IHttpHandler that could possibly handle that filetype.
This leads to fun bugs, such as StackOverflow's MiniProfiler no longer working, because it requests a file such as:
Which PipelineHandler (when trying to handle .css) says "oh, it doesn't exist" and sends a 404, killing the response instantly.