I have a question regarding RouteLink vs. ActionLink.
Consider the following route
routes.MapRoute("Routename1",
"{someEnum}/SpecificAction/{id}/{stringId}",
new { controller = "MyController", id = (int?)null, stringId= (string)null, action = "SpecificAction" },
new { someEnum= "(EnumVal1|EnumVal2)" }
);
The weird {someEnum} part is because I use a general controller for all values of an enum that form the typical controller part of a url. For instance, /EnumVal1/Action/ and /EnumVal2/Action/ use the same controller. That's not part of the problem, however.
Consider the following two ways of linking:
<%=Html.RouteLink("Click me","Routename1", new { id = 32, stringId = "Yatzy" })%>
<%=Html.ActionLink("Click me", "SpecificAction", "EnumVal1", new { id = 32, stringId = "Yatsy" }, null)%>
The RouteLink generates the correct url, which would be /EnumVal1/SpecificAction/32/Yatzy
The ActionLink generates an url that looks like /EnumVal1/SpecificAction/32?stringId=Yatzy
Why is this? Could someone explain this to me, please.