Process application_start without global.asax

Is there a way to handle the application_start

" event " without using global.asax?

The best I can think of is the HttpModule, which checks a static variable on each one begin_request

, which is INCREDIBLY wasteful :(

Do I have other options?

thank

+2


source to share


2 answers


AFAIK the thought-based "pseudo-events" in Global.asax are not available in any other way than reflection. However, for the application_start event, you could achieve similar functionality by overriding the Init () method in your HttpApplication subclass. Some functionality may not be available as it probably fires at a slightly different point in the lifecycle.



Alternatively, if you are going to use an HttpModule, could you just use the Init () method instead of begin_request?

0


source


If your code exists on a website, you can use the mostly undocumented "AppInitialize" method. Add this static method to any class in your web project.

(Note: it won't work if it's contained in a compiled assembly inside the site.)



Search for "AppInitialize" for more information. (Example: http://www.bing.com/search?q=appinitialize+msdn&src=IE-SearchBox&FORM=IE9bSRC )

0


source







All Articles