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結構如下:


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章