ASP.Net MVC Route to Username

后端 未结 5 1238
难免孤独
难免孤独 2020-12-22 17:39

I am trying to create a route with a Username...

So the URL would be mydomain.com/abrudtkhul (abrudtkhul being the username)

My application will have public

5条回答
  •  忘掉有多难
    2020-12-22 18:32

    Are you trying to pass it as a parameter to a Controller?

    Theoretically you could do something like this:

    routes.MapRoute("name", "{user}/{controller}/{action}", new { controller = "blah", action = "blah", user = "" })

    I'm not too experienced with ASP.NET routing, but I figure that should work.

提交回复
热议问题