I'm trying to have a page on an ASP.NET MVC based web site where one page allows selecting by username instead of ID. I would have thought the route needs to be something like:
routes.MapRoute(
"CustomerView", "Customer/Details/{username}",
new { username = "" }
);
routes.MapRoute(
"Default", "{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = "0" }
);
but whenever I use HTML.Actionlink I get http://mysite.com/Customer/Details?username=valuehere . I considered a generic route like:
routes.MapRoute(
"CustomerView", "Customer/Details/{username}",
new { controller="Customer", action = "Details", username = "" }
);
but I imagine it would cause more problems when it mistakes which route should be applied of the two.