开发者

handling unique urls for each user

开发者 https://www.devze.com 2023-03-01 06:58 出处:网络
I want to provide each users of website a separate url but all users will see sam开发者_开发百科e pages.

I want to provide each users of website a separate url but all users will see sam开发者_开发百科e pages.

www.myweb.com/user1/logon

www.myweb.com/user2/logon

similary

www.myweb.com/user1/wellcome

www.myweb.com/user2/wellcome

Is there any mechanism in asp.net mvc so that I can handle such things?


Isn't a route working for you:

routes.MapRoute(
    "MyRoute",
    "{user}/{action}",
    new { controller = "Home", action = "Index" }
);

You might also need a custom Authorize attribute to ensure that the user token coming from the url matches the one in the authentication cookie or user1 could type in the url user2 and see his pages, but if this is not a requirement for you you don't need to.

0

精彩评论

暂无评论...
验证码 换一张
取 消