In the view
@Html.ActionLink("Edit", "Edit", new { id = 1, year = 1 })
In the controller
// GET: /Forecasts/Edit/5
public ActionResult Edit(int id, short year)
{
...
}
It generated a url like
http://<localhost>/controllername/actionname/1?year=1
I would expect the actionlink generate a URL like :
http://<localhost>/controllername/actionname/?id=1&year=1
This url cannot be interpreted by MVC default routing, why the URL is not generated in the expected way? Thanks.
Update: Now I found out it was a typo caused this problem for me, but the answer below is still good enough as it help me to further understand the way route works