複数のパラメーター名を持つ同じエリア内の複数のコントローラーにルーティング マップを提供する方法を知っている人はいますか?
一意のパラメーター名を持つ各コントローラーのパラメーター名なし (値のみ) の URL を提供する要求があります (あいまいさを避けるため)。
これは可能ですか?
この出力を URL で取得したいと思います。
/myAreaName1/mycontrollerName1/Edit/12/23
/myAreaName1/mycontrollerName2/Edit/someValue1/23
次のようなものを使用します。
context.MapRoute(
"mapRouteName1",
"myAreaName1/{controller}/{action}/{customID}/{sustomID2}",
new { controller = "mycontrollerName1", action = "Index", customID= UrlParameter.Optional, sustomID2= UrlParameter.Optional },
new string[] { "Project.Areas.SomeArea.Controllers" }
);
context.MapRoute(
"mapRouteName1",
"myAreaName1/{controller}/{action}/{customValue}/{sustomID3}",
new { controller = "mycontrollerName2", action = "Index", customValue= UrlParameter.Optional, sustomID3= UrlParameter.Optional },
new string[] { "Project.Areas.SomeArea.Controllers" }
);