It's most common practice to register routes in Application_Start event within global.asax.cs/vb file. But you need to have access to this file to do so. Fine.
I either don't have or don't want to. I'm trying to integrate Asp.net MVC application into a Sharepoint 2010 site and don't want to create my custom global application class that would also register routes for me and change the Sharepoint's Global.asax file and put a different class definition in it. My application wouldn't be accepted because I would be doing unsupported things to Sharepoint.
I was wondering if it was possible to register routes some place else then? There are two alternatives that first popped into my mind:
Write an HttpModule and abuse application start event as well. This way I would inject application start event code without mangling with global.asax that I can't access. Adding another HttpModule in web.config is something I can do.Note: Application-level events are not accessible in modules. Bummer. They can only access request-level events.
Important: ... or so I thought. If you check accepted answer it's actually possible to handle application-level start event. Indirectly and reliably it is possible.
Write an HttpModule and abuse some other event like request start. Of course I would also have to keep some data somewehere that my routes have already been registered and that registration would happen only the first time round.
Are there any better ways/places to register routes?