views:

123

answers:

1

I keep getting errors like this after my pages are done refreshing.

The controller for path '/S43G/S4_Manager/WebResource.axd' could not be found or it does not implement IController.

but I get the error for any file that does not exist on my hard drive. regardless of extension (.png, .css, etc)

I've tried all of the following to fix it, and I'm stumped.

routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.IgnoreRoute( "{resource}.axd" );
routes.IgnoreRoute( "WebResource.axd" );

routes.MapRoute(
"Default",                                              // Route name
"{controller}/{action}/{id}",                           // URL with parameters
new { controller = "Home", action = "Index", id = "" },  // Parameter defaults
new { controller = @"[^\.]*" }
      );

Any ideas what I need to put in my routing to prevent it throwing exceptions everytime a file does not exists.

barring those how to I fix the WebResoruce.axd issue, since WebResoruce.axd not supposed to exist.

Thanks,

Eric=

A: 

I think my answer here gives a solution to your problem, simply match all urls and use a constraint to check if the filetype is .axd.

Then all you need is the following to handle 404 requests after all other MapRoutes():

 routes.MapRoute(
           "Error404CatchAll", // Route name  
           "{*url}", // URL with parameters
           new { controller = "Error", action = "Http404" } // Parameter defaults
           );
MVC-dot-net