I have an MVC application and my error handling is set up like this in web.config:
<customErrors mode="On" defaultRedirect="~/Error/" redirectMode="ResponseRedirect">
<error statusCode="404" redirect="~/Error/NotFound/" />
</customErrors>
Every time a request for non existing image comes my NotFound action on Error controller is being hit, and I get an error The controller for path '/img/home/myimg.jpg' was not found or does not implement IController.
logged.
I added RouteTable.Routes.IgnoreRoute("img/");
to my Global.asax
but it doesn't help.
How can I make MVC to ignore all requests to any files?
Thanks