I'd like to have an Index action for a "Users" controller that takes an optional parameter.
/Users/{id}
Or
/Users
I'd like to avoid:
/Users/Index/{id}
Or
/Users/Index/
I added a Route to map /Users/{id} to the Index action.
routes.MapRoute( "Users",
"Users/{id}",
new { controller = "Users", action = "Index", id =
UrlParameter.Optional});
That works fine. I ran into a problem when I added another action, "Add", also with an optional parameter, to the Users controller. The route I added earlier misinterprets Add as a parameter to the Index action. The "Index" action gets triggered for /Users/Add.
How can I get the best of both?
Thanks.