ASP.NET MVC Default URL View

后端 未结 4 1902
孤独总比滥情好
孤独总比滥情好 2020-12-15 23:06

I\'m trying to set the Default URL of my MVC application to a view within an area of my application. The area is called \"Common\", the controller \"

4条回答
  •  醉梦人生
    2020-12-15 23:48

    In the Global.asax delete the .MapRoute

    and make it look like

    public static void RegisterRoutes(RouteCollection routes)
    {
       routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
    }
    

    then under the area's yourareaAreaRegistration.cs (its there if you added the area through VS)

    public override void RegisterArea(AreaRegistrationContext context)
    {
         //This is the key one         
         context.MapRoute("Root", "", new { controller = "Home", action = "Login" });
    
         //Add more MapRoutes if needed
    }
    

提交回复
热议问题