How to implement User routing like that in StackOverflow ?

Posted by rockinthesixstring on Stack Overflow See other posts from Stack Overflow or by rockinthesixstring
Published on 2010-06-08T19:24:57Z Indexed on 2010/06/08 19:42 UTC
Read the original article Hit count: 236

Filed under:
|

I've looked at the routing on StackOverflow and I've got a very noobie question, but something I'd like clarification none the less.

I'm looking specifically at the Users controller

http://stackoverflow.com/Users
http://stackoverflow.com/Users/Login
http://stackoverflow.com/Users/124069/rockinthesixstring

What I'm noticing is that there is a "Users" controller probably with a default "Index" action, and a "Login" action. The problem I am facing is that the login action can be ignored and a "UrlParameter.Optional [ID]" can also be used.

How exactly does this look in the RegisterRoutes collection? Or am I missing something totally obvious?

EDIT: Here's the route I have currently.. but it's definitely far from right.

    routes.MapRoute( _
        "Default", _
        "{controller}/{id}/{slug}", _
        New With {.controller = "Events", .action = "Index", .id = UrlParameter.Optional, .slug = UrlParameter.Optional} _
    )

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about routing