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 strange part of {someEnum} is that I use a common controller for all enumeration values ββthat form the typical part of a URL controller. For example, / EnumVal1 / Action / and / EnumVal2 / Action / use the same controller. However, this is not part of the problem.
Consider the following two binding methods:
<%=Html.RouteLink("Click me","Routename1", new { id = 32, stringId = "Yatzy" })%> <%=Html.ActionLink("Click me", "SpecificAction", "EnumVal1", new { id = 32, stringId = "Yatsy" }, null)%>
RouteLink generates the correct URL, which will be / EnumVal 1 / SpecificAction / 32 / Yatzy
Does ActionLink generate a URL that looks like / EnumVal 1 / SpecificAction / 32? stringId = Yatzy
Why is this? Can someone explain this to me please.
c # asp.net-mvc routes actionlink
Terje
source share