ASP.Net Webforms and MVC3 global.asax/routes being ignored

413 Views Asked by At

I have a mixed ASP.Net and MVC3 project. Site delivers both aspx and MVC views. Essentially working EXCEPT all .axd requests are being intercepted by MVC and causing exceptions:

The controller for path '/Members/Chart.axd' was not found or does not implement IController.

My routes look like this:

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

There are 1 best solutions below

1
On

Try this:

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

.axd files are originally designed for asp.net controls; maybe they didn't anticipate third-party followers to add subfolders to these urls.

I probably didn't explain that right, but my point is that "{resource}.axd" assumes that the url is pointing to .axd file sitting in the site-root, and not in some subfolder.