I have a web site that had no areas registered. Then I registered an area called "MyNewArea
".
Now my default website links like blogs etc no longer work.
So I now have an areas folder with a single area in it and the default folders when I created the project in the first place.
In my area AreaRegistration
class I have;
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
"MyArea_default",
"{controller}/{action}/{id}",
new { action = "Index", id = UrlParameter.Optional }
);
}
but this looks like it conflicts with the default one of
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
What do I need to do to get the area to work with the default site and controllers?
Change the new area route table to be:
context.MapRoute(
"MyArea_default",
"MyNewArea/{action}/{id}",
new { controller = "MyNewArea", action = "Index", id = UrlParameter.Optional }
);