Reputation: 91
I have a route setting for Profile controller In order to view the profile page like http://localhost/Profile/MyUserName
routes.MapRoute("Profile", "Profile/{userName}", new { controller = "Profile", action = "Index", userName = "" });
These works fine.
My problem is that because the profile controller has many actions Like... Profile/Edit, Profile/Save, Profile/Updates, Profile/etc.... so on.. All of these actions got hit in the route "Profile/{userName}". In order to fix it i have to map all of these actions in the route table which is very ugly bec. i only want to map the route "Profile/{username}"
Is there a way that i can map only 1 route to profile controller and the rest i dont care about their url format?
im using mvc 1
Upvotes: 0
Views: 217
Reputation: 449
Instead Profile/{userName} I'm using Profile/View/{userName}. In this way I avoid case, when username is Edit or Save.
Upvotes: 1