我有一个生成此URL的ActionLink
@Html.ActionLink("Hardware Profile", "Profile", "Device", new { id = 2, tab = "hardware"}, null)
//Produces: http://localhost:7946/Device/Profile/2?tab=hardware
但我想要它产生的是:
http://localhost:7946/Device/Profile/2/hardware
我有以下路线设置
routes.MapRoute(
"DeviceProfile",
"device/profile/{id}/{tab}",
new { controller = "Device", action = "Profile", id = UrlParameter.Optional, tab = UrlParameter.Optional }
);
我如何实现这一目标?