MVC ActionLink generating NON-Restul URL AFTER adding constraints
- by brianstewey
Hello
I have a custom route that without constraints generates a Restful URL with an ActionLink.
Route -
routes.MapRoute(
"Blog", // Route name
"Blog/{d}/{m}/{y}", // URL with parameters,
new { controller = "Blog", action = "Retrieve" }
Generates -
http://localhost:2875/Blog/12/1/2010
From -
<%=Html.ActionLink("Blog Entry - 12/01/2010", "Retrieve", "Blog", new { d = 12, m = 01, y = 2010 }, null)%>
If I add constraints like so.
routes.MapRoute(
"Blog", // Route name
"Blog/{d}/{m}/{y}", // URL with parameters,
new { controller = "Blog", action = "Retrieve" },
new { d = @"\d{2}", m = @"\d{2}", y = @"\d{4}" }
It generates -
http://localhost:2875/Blog/Retrieve?d=12&m=1&y=2010
Extra information: it is added before the custom route.
Any ideas?
Cheers