I registered a route:
routes.MapRoute(
"Journals",
"Journals/{year}/{month}/{id}",
new {
controller = "Journals",
action = "Get",
year = UrlParameter.Optional,
month = UrlParameter.Optional,
id = UrlParameter.Optional
}
);
Action:
public ActionResult Get(int? year, int? month, int? id)
Later in view (just to check):
@Url.Action("Get", "Journals")
@Url.Action("Get", "Journals", new { year = 2013 })
@Url.Action("Get", "Journals", new { year = 2013, month = 4 })
@Url.Action("Get", "Journals", new { year = 2013, month = 4, id = 1 })
And result is:
/Journals
/Journals
/Journals/2013/4
/Journals/2013/4/1
So the 2nd URL missed the parameter. What's wrong?