Tuesday 8 March 2011

ASP.NET MVC Getting a default route to point to an Area

This seems like such an obvious thing to want to do, but isn't clear from searching the web how this is done.
After many attempts, if found the solution, which is very easy:
 
routes.MapRoute("Defaults_Route" ,
"" ,
new { area = "MyArea" , controller = "Home" , action = "Index" }
).DataTokens.Add("area" , "MyArea" );

Submit this story to DotNetKicks Shout it