Are AspMvc RouteCollections reset every request?
As the question says, with asp mvc is the RouteCollection object reset for each request... I thought it was set on an application level not per request.
== Edit ==
To give more context to why I am asking this question.
I currently have a web app which has 2 default routes and uses MEF to load additional routes in dynamically from plugins, now I was wondering why my routes were not appearing in the route table debugger, and when debugging every request was calling the plugins with the current routetable, but it had only the default routes.
So every request it appeared to be sending the plugins a new route table with only the 2 default routes, it then adds lets say 5 more routes bringing the total to 7, however then on next refresh it is back down to 2.
So I was a bit puzzled as t开发者_如何学JAVAo why it keeps seemingly resetting the routes constantly.
Route registration is generally done in Application_Start
which runs only once. They could be cleared with something like RouteTable.Routes.Clear()
, but it doesn't sound usual for them to be reset.
That said, I don't know anything about MEF, so it's possible that registering routes through it behave differently to how you'd usually do it in Global.asax in a template-created MVC site.
精彩评论