Set default area - Avoiding `, new {area = ""}` on each link on the site
.net, asp.net-mvc, asp.net-mvc-areas
Solution
Url actions are relative to the location of the link. So `new {area = ""}` is not telling the Url.Action call that there is no area, it's telling it to use the root area. If you omit `new {area = ""}` from the Url.Action call it will try to create a url for the specified action within the specified controller within the current area (the "Area" are in your case).
Therefore it is unavoidable if you want to link from a subarea to the root area.
Problem
This code is inside the master page: ``` <li><a href="<%=Url.Action("Action", "Controller") %>">Main site link</a></li> <li><a href="<%=Url.Action("AreaAction", "AreaController", new {area = "Area"}) %>">Area link</a></li> ``` All the links works good till I'm going to the Area Link. When I go there all the routes of the main area don't work. To fix that I can use this: ``` <li><a href="<%=Url.Action("Action", "Controller", new {area = ""}) %>">Main site link</a></li> ``` My question is, is there a way to avoid `, new {area = ""}` on every link in the to the main site? Its very annoying to have this on every link on the site.