I have this routes:
routes.MapRoute(
"Default",
"user/{userId}/{controller}/{action}",
new {controller = "Home", action = "Index" }
);
routes.MapRoute(
"Short",
"{controller}/{action}",
new { controller = "Home", action = "Index"}
);
My current location in browser:
On this page there are links:
@Html.ActionLink("Friends", "Index", "Friends")
@Html.ActionLink("Information", "Index", "UserInfo", new { userId = (string)null },null)
MVC re-use query parameters , so the first generated link:
my_site/user/197/Friends
The second link is generated:
my_site/UserInfo?userId=197
Why userId in the second link has a value of 197? Why not have a link:
my_site/UserInfo