0
在區域VIPUsers我有控制器ProfileController和其他控制器。在ASP.NET MVC中映射路由和參數
如果我想在每ProfileController可方法有參數(ID) 及其他控制器的每一個方法有參數(用戶名和ID) 我將如何映射它?
難道是
context.MapRoute(
"ProfileMapping",
"VIPUsers/Profile/{action}/{id}",
new {controller="ManageUsers", id=""}
);
然後映射所有控制器默認嗎?
context.MapRoute(
"Default",
"VIPUsers/{controller}/{action}/{userId}/{id}",
new {action="Index", userId="", id = ""}
);
and ...就是這樣嗎?我看到它的工作,但它很奇怪...
如果我去ProfileController上的一個頁面,給它兩個參數{action}
(VIPUsers/Profile/SomeAction/4/4 /)之後,它會使用第二個映射路線。那是對的嗎?
感謝
,如果我想要的網址總是需要一個用戶ID,我怎麼指定?