I have this route defined:
routes.MapRoute(
"Details", // Route name
"{home}/{details}/{id}/{name}", // URL with parameters
new
{
controller = "Home",
action = "Details",
id = UrlParameter.Optional,
name = UrlParameter.Optional
} // Parameter defaults
);
The ActionLink:
@Html.ActionLink("Show Details", "Details", "MyController", new { id = 1, name ="a" })
The actionlink results in /Home/Details/1?name=a
I am after /Home/List/1/a
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…