I found myself recently needing to get rid of the Global.asax file. In building a CDN for myself, having a global.asax file forces cookies to be sent with requests, and for the static content I am serving through my CDN, this is a no-noSo what to do? I still need to do some page routing for a URL shortening service that is tied directly into this cdn (o7t.in is a shor url =))The answer was pretty much staring me in the face, I just did not realize it, for about 2 days staring at it. The answer is to use an HTTPModule that imports System.Web, and System.Web.Routing. Right inside the Init() event is where you would do all your Application_Start stuff!Just make sure to double check that you do not already have a named route in the collection, because an HTTPModule checks every single request, and the Init() Event fires each time. (It’s really simple to check…)
If RouteTable.Routes IsNot Nothing AndAlso Not (RouteTable.Routes.Count > 0) Then 'Register your routes here! End If
That;s all for now, happy coding!