We have URLs of the form
http://site/controller.mvc/action
If we accidentally write a relative URL for an image into the html (say src="imgs/img1.gif"
) this results in the browser making a request to:
http://site/controller.mvc/action/imgs/img1.gif
Which gets routed through to the controller but then cannot resolve to an action method.
This is fine except we would rather use routing to prevent this ever happening (so TempData doesn't get emptied and whatever).
However if we put a custom constraint in to stop this happening (using Regular Expressions) we get a 200 and an empty response rather than the expected 404. Any ideas?