Can I modify an MVC route outside of Global.asax?
Is it possible to modify the the routes (and thus the RouteTable) outside of the global.asax file, maybe in a controller? Is this even advisable?
My reason for asking has to do with IIS 6 and Integrated Mode not allowing for Request context calls. I'm implementing internationaliz开发者_如何转开发ation for a site and keeping track of the culture in the URL. The culture is originally read from a .config file and loaded as a route default. This file read is what ends up throwing the error (another few steps up the stack). I based this off the method described here.
You can access the routing table pretty much anywhere like so System.Web.Routing.RouteTable.Routes, have tested this from a controller and it worked fine.
精彩评论