No, you can dynamically add and remove routes. RouteTable.Routes is just a RouteCollection that has Add and Remove members (or, if you want, Clear ).
Remember that the web server is multithreaded, so you need to use the RouteCollection blocking RouteCollection . In particular, this means GetWriteLock :
var routes = RouteTable.Routes; var newDynamicRoute = new Route(...); using(routes.GetWriteLock()) { routes.Remove(dynRoute); dynRoute = newDynamicRoute; routes.Add(dynRoute); }
Eamon nerbonne
source share