Reputation: 1867
Well, technically it is an ASP.net routing question but since I am using MVC 3 here we go.
I need to setup a route as follows: http://www.mysite.com/profile/1 where 1 is the userid, however I want to hide the userid param in the query string because it is just plain ugly.
Controller is ProfileController Action is Index parameter is userid.
I can't seem to figure this out. I am probably thinking about it too much... Any help would be ultra cool.
Upvotes: 2
Views: 100
Reputation: 15810
The route should be nice and simple. It needs to come before your default route handler.
routes.MapRoute(
"Profile", // Route name
"profile/{userId}", // URL with parameters
new { controller = "Profile", action = "Index" } // Parameter defaults
);
Upvotes: 1