views:

121

answers:

1

Hi,

I want to stroe my routes in DB and register them in Application_Start of Global.asax.cs. Everything is fine but any change in the DB, I have to reset the app in order to let app to pick up my changes.

If i can reset the routes without restart the app, the problem will be solved. How would I achive it geeks? A custom httpmodule? or...

+2  A: 
public static void UpdateRouteRegistration() {
  RouteCollection routes = RouteTable.Routes;
  using (routes.GetWriteLock()) {
    routes.Clear();
    // repopulate route table here
  }
}

Then call this method from Application_Start and any other time you need to initialize the route table. Note: This is from memory and might be slightly mistyped, but you get the idea. :)

Levi