开发者

Personalization in ASP.Net MVC -- friendly URLs, and skinning

I haven't delved into custom generation of friendly URLs in ASP.Net MVC, and was wondering if anyone had suggestions. For example, if John Smith were to cre开发者_开发知识库ate an account on www.example.com, I'd like for his homepage to read www.example.com/JohnSmith -- along with the option for him to choose his URL. The ideal is for this to happen with no intervention on my part in the route maps.

Also, does anyone have guidelines on good ways to go to customize an MVC site based on URL? Again, using example.com I'd like for John to choose a color theme and logo for his homepage, then apply it accordingly.

Thanks for your tips and suggestions.


You can use routing for this where the second part is a key to which site it is.

routes.MapRoute(
            "Default",                                              // Route name
            "{site}/{controller}/{action}/{id}",                           // URL with parameters
            new { controller = "Home", action = "Index", id = "" }  // Parameter defaults
        );

so that site becomes a variable available to every action.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜