views:

56

answers:

1

Hi,

is it possible to create and register routes after Application.Start() is called?

let's say have a controller, PersonController. With default routing, URLs could look something like www.site.com/Person/Edit/4, with 'Person' matching the controller.

now imagine I have several users, some may prefer we use the term 'Friends'. I would like to use the same controller, and have /Friends/Edit/4 map to the same controller/action/id. Maybe someone else prefers /Comrades/Edit/4.

with the naming preferences stored in a database, is there a way that I can dynamically create these routes at some point mid-application, after the user has logged in?

thanks!

A: 

What about holding the preferences in your config file.

You could then in application start read the config file and apply the routes.

So then when you deploy to a client you can deploy with their config file and if they change their mind deploy another config file.

i guess you could create the routes at anytime but the default one will still need to be done at the start else mvc won't even work i don't think.

griegs
hithanks for your suggestion, but the config file idea won't work for our situation
joe q.