0

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

1 Answer 1

1

Instead Profile/{userName} I'm using Profile/View/{userName}. In this way I avoid case, when username is Edit or Save.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks petch... i guess i should add unique url path in order to avoid clash of routes.. i just thought i wanted to make my url shorter and clean that's why.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.