ASP.NET MVC User routing like that in StackOverflow?

前端 未结 2 411
醉酒成梦
醉酒成梦 2021-01-02 01:03

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

2条回答
  •  离开以前
    2021-01-02 01:45

    Without a SO developer giving a definite answer, reverse engineering could yield many possible combinations and permutations. Here's one that I think would fit too:

    routes.MapRoute(
        "UserProfile",
        "Users/{id}/{slug}",
            new { controller = "Users", action = "Profile" }
    );
    
    routes.MapRoute(
        "UserLogin",
        "Users/Login",
        new { controller = "Users", action = "Login" }
    );
    
    routes.MapRoute(
        "DefaultUser",
        "Users",
        new { controller = "Users", action = "Index" }
    );
    

提交回复
热议问题