Default-Route for root of application

Viewed 8443

How can I tell my mvc-application to route to a specific Controller and Action when they are not specified?

When debugging http://localhost:54500/ should route to http://localhost:54500/Home/Index.

Currently I have:

routes.MapRoute(
    name: "Root",
    url: "",
    defaults: new { controller = "Home", action = "Index" }
    );

routes.MapRoute(
    name: "Default",
    url: "{controller}/{action}/{id}",
    defaults: new { id = UrlParameter.Optional }
    );

But this always throws

The view 'Index' or its master was not found or no view engine supports the searched locations

Edit #1

It should redirect/route to an View which resides in a Area called Home. Just want to clarify, that there is a Controller and an Area which both are named Home.

The config for the area is:

public override void RegisterArea(AreaRegistrationContext context)
{
    context.MapRoute(
        "Home_default",
        "Home/{controller}/{action}/{id}",
        new {action = "Index", id = UrlParameter.Optional}
        );
}
2 Answers
Related