In an ASP.NET MVC 3 application with scopes (see diagram below). The Controllers directory has been deleted from the root.
When I do this:
routes.MapRoute(
"Default",
"{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
I get this error: Several types were found that match the controller named "Home". This can happen if the route serving this request ('{controller} / {action} / {id}') does not specify a namespace to find the controller that matches the request. If so, register this route by calling the MapRoute overload, a method that accepts the namespaces parameter. The following matching controllers were found in the Home request: MyProject.Areas.Administration.Controllers.HomeController MyProject.Areas.BackEnd.Controllers.HomeController MyProject.Areas.FrontEnd.Controllers.HomeController
When I do this:
routes.MapRoute(
"Default",
"{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = UrlParameter.Optional },
new string[] { "MyProject.Areas.Administration.Controllers" }
);
I get a tis error:
The view 'Index' or its master was not found or no view engine supports the searched locations. The following locations were searched:
~/Views/Home/Index.aspx
~/Views/Home/Index.ascx
~/Views/Shared/Index.aspx
~/Views/Shared/Index.ascx
~/Views/Home/Index.cshtml
~/Views/Home/Index.vbhtml
~/Views/Shared/Index.cshtml
~/Views/Shared/Index.vbhtml
---- Areas
|
|---- Administration
| |--- Controllers
| | |---- HomeController
| |--- Views
| |--- Index
|---- FrontEnd
| |--- Controllers
| | |---- HomeController
| |--- Views
| |--- Index
|---- BackEnd
|--- Controllers
| |---- HomeController
|--- Views
|--- Index
Update1
To start with a specific controller in the Regions, I tried this:
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default",
"{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = UrlParameter.Optional },
new[] { "MyProject.Areas.BackEnd.Controllers" }
);
}