ASP.NET MVC 調用指定域的Controller
1 回答

慕田峪4524236
TA貢獻1875條經驗 獲得超5個贊
在路由配置里面,加上限制條件,把Controller 的命名空間寫進去。
多個域有相同Controller 就必須加上命名空間. MVC3和MVC4寫法不一樣
1 2 3 4 5 6 | routes.MapRoute( "AdminControllers", // 路由名稱 "{controller}/{id}-{action}", // 帶有參數的 URL new { controller = "Home", action = "Index", id = UrlParameter.Optional }, // 參數默認值 new string[] { "Admin.Controllers" }//命名空間 ); |
在頁面也好指明域
- 1 回答
- 0 關注
- 444 瀏覽
添加回答
舉報
0/150
提交
取消