views:

583

answers:

1

I'm building a CMS in ASP.NET MVC and want to allow users to pick which page they want to be displayed by default when the user first visits the site.

I set my default route in Global.asax, like so (for example):

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

But then later I want to change the default route in an HttpModule based on something I retrieve from a data source; how can I change that default route initially setup in Global.asax? Is it too late to change the routing table in the HttpModule and if so how can I realise this feature?

+1  A: 

Perhaps I'm not understanding the question but why not just store the URL of the 'homepage' that the user has selected and set any Home links to goto that URL and not worry about the routing?

Routes are global and affect all users, if you were to change it then all users would be affected, no?

Vyrotek