I created MVC Application that have 3 different Area. (Admin, User, News) This is my RouteConfig.cs File in App_Start directory:
public class RouteConfig
{
Just create a static class name it AreaConfig with a static method RegisterAreas() here code:
public static class AreaConfig
{
public static void RegisterAreas()
{
//
// Admin area . . .
var adminArea = new AdminAreaRegistration();
var adminAreaContext = new AreaRegistrationContext(adminArea.AreaName, RouteTable.Routes);
adminArea.RegisterArea(adminAreaContext);
//
// Default area . . .
var defaultArea = new DefaultAreaRegistration();
var defaultAreaContext = new AreaRegistrationContext(defaultArea.AreaName, RouteTable.Routes);
defaultArea.RegisterArea(defaultAreaContext);
}
}
then call it in a Global.asax.cs file like this:
protected void Application_Start()
{
. . .
AreaConfig.RegisterAreas();
. . .
}