1
我有2種途徑在路線
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
routes.MapRoute(
name: "Plugin",
url: "{pluginName}/{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
設置自定義參數我想用Html.Action幫手,並設置我的第二條路線的「pluginName」參數。
我嘗試使用下面的代碼
@Html.Action("Index","Person",new RouteValueDictionary { { "pluginName", "myPlugin" } });
,並得到像
http://mydomain/myplugin/Person/index
鏈接,但我已經越來越
http://mydomain/Person/index?pluginName="myPlugin"
我怎樣才能得到第一個鏈接模式?
謝謝你,它的工作原理 – Polaris
優秀 - 高興能幫上忙。不要忘記標記答案,以便幫助他人。謝謝! –