I created an empty MVC4 Application, all things are working fine, after that I add an Area to my Project Named \"Moderator\". My area routing code is like this:
I had the same problem. You look to App_Start/RouteConfig.cs and add top this code AreaRegistration.RegisterAllAreas();
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
AreaRegistration.RegisterAllAreas();
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
}
Create create Areas/Moderator/Controllers/DashboardController.cs
public class DashboardController : Controller
{
//
// GET: /Moderator/Dashboard/
public ActionResult Index()
{
return View();
}
}
and create
Areas/Moderator/Views/Dashboard/Index.cshtml
You also need to have Web.config in Areas/Moderator/Views/Web.config ...