If you not defining a proper routing, you won't accomplish your goal.
Looks like you need a better understanding on routing.
Please refer to
https://docs.microsoft.com/en-us/aspnet/mvc/overview/older-versions-1/controllers-and-routing/asp-net-mvc-routing-overview-cs
You are not following the convention in those cases where you want to use explicit routing instead of using the query string.
Try adding the default values into the route definition.
new {controller = "Movie", action = "ByReleaseDate" ,year=0, month=0 }
Basically when you defining routings you need to define the way that you will receive the information.
new {controller = "Movie", action = "ByReleaseDate" }
Will allow you to route below patterns
- {controller}/{action}
- {controller}/{action}? "query string"
new {controller = "Movie", action = "ByReleaseDate",year=0 }
Will allow you to route below patterns
- {controller}/{action}/year
- {controller}/{action}? "query string"
- {controller}/{action}/year? "query string"
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…