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/logonsimilary
www.myweb.com/user1/wellcome www.myweb.com/user2/wellcomeIs 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.
精彩评论