I am having one controller Test having following actions
public ActionResult ABC (string parameter1, string parameter2)
public ActionResult XYZ (string parameter1, string parameter2,string parameter3, string parameter4)
i have added following html.routelinks
<%= Html.RouteLink("ABC","ABC", new { parameter1 = 100, parameter2 = 200 } )%><br />
<%= Html.RouteLink("XYZ", "XYZ", new { parameter1 = 1000 , parameter2 = 2000 }) %>
last two parameters in XYZ action are optionals so i have omitted them in Html.routelink
routes.MapRoute("ABC", "Test/{parameter1}{parameter2}", new { controller = "Test", action = "ABC", parameter1= 0,parameter2=0 });
routes.MapRoute("XYZ", "Test/{parameter1}{parameter2}{parameter3}{parameter4}", new { controller = "Test", action = "XYZ", parameter1=0,parameter2=0 ,parameter3=UrlParameter.Optional,parameter4=UrlParameter.Optional});
In above senario in both cases same route "ABC" is called eventhough i have clicked on second Html.routelink. can anyone solve this issue ? how can i route according to route name instead of number of parameters?