1. 程式人生 > >asp.net mvc設定area頁面為預設路由

asp.net mvc設定area頁面為預設路由

1.在routeconfig裡新增如下程式碼:

routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional },
                namespaces:new string[]{"EFTest.Controllers"}
            ).DataTokens.Add("Area","Test");

area結構如下: