I'd like to have routes set up as follows:
"xyz/" maps to one action method with no parameters, but "xyz/{username}" maps to a different action (in the same controller or not, doesn't matter) that takes an argument called username of type string. Here are my routes so far:
routes.MapRoute(
"Me",
"Profile",
new { controller = "Profile", action = "Me" }
);
routes.MapRoute(
"Profile",
"Profile/{username}",
new { controller = "Profile", action = "Index" }
);
routes.MapRoute(
"Default",
"{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
Currently, if I navigate to "/Profile/someuser", the Index action in the Profile controller is hit as expected. But if I navigate to "/Profile/" or "/Profile", I get 404. What gives?