Between my core app Global.asax and my Portable Areas how should I be
mapping routes so that the PA defaults will be used?
Currently my Portable Areas will not respond unless I specify a
controller.
For example I have a PA named Foo and if I try to access it like
"
domain.com/Foo/" I get "Resource Not Found". If I use "
domain.com/Foo/
Home" it works.
I also have a local area in my main project named Admin, I am able to
access this area by "
domain.com/Admin/"
In my Foo PA I have the following route..
context.MapRoute(
"Foo_default",
"Foo/{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id =
UrlParameter.Optional },
new string[] { "CoolProject.Component.Foo.Controllers" }
);
and in my Global.asax I have the following route...
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id =
UrlParameter.Optional },
new string[] { "CoolProject.Web.Controllers" }
);
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
PortableAreaRegistration.RegisterEmbeddedViewEngine();
RegisterGlobalFilters(GlobalFilters.Filters);
RegisterRoutes(RouteTable.Routes);
InitializeContainer();
AppStart_Structuremap.Start();
SiteMapManager.SiteMaps.Register<XmlSiteMap>("AdminNavigation",
sitemap => sitemap.LoadFrom("/Areas/Admin/AdminNavigation.sitemap"));
}