How to do normal asp.net routing (controller hardcoding)
I am trying to create a route for the following urls: www.mysite.com/user/username www.mysite.com/user/username/pictures
I tried to do it with the following code:
routes.MapRoute(
"UserProfile",
"user/{sn}/{action}",
new { controller = "User", action = "Index", sn = "" }
);
So, if no action is specified, you go to the index action.
However, it doesn't work and I'm not sure what I am doing wrong.
Thanks for any help.
0
source to share
2 answers
I agree with maxnk, the code looks correct, this is probably just an order. I would suggest checking out the Route Debugger that Phil Haack wrote: http://haacked.com/archive/2008/03/13/url-routing-debugger.aspx . This is very useful for these complex route ordering problems.
+1
source to share