Whenever I create a project with areas, I change the route Defaultas follows:
routes.MapRoute(
"Default",
"{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = UrlParameter.Optional },
null,
new string[] { "MyApplication.Controllers" }
);
The last parameter restricts the default route to controllers in the namespace MyApplication.Controllers. This ensures that the default route is limited to activities outside of any areas.
UPDATE
, , . :
routes.Add(
"Default",
new Route("{controller}/{action}/{id}",
new RouteValueDictionary(
new { controller = "Home", action = "Index", id = UrlParameter.Optional }
),
null,
new RouteValueDictionary(
new {
Namespaces = new string[] { "MyApplication.Controllers" },
UseNamespaceFallback = false
}
),
new MvcRouteHandler()
)
);
UseNamespaceFallback. .
, , , , . aspnet.codeplex.com. , MVC.