How to add Application_End handler without using global.asax?

I am writing an http module, and I want to add a method that is called when (and only when) appdomain receives recirculation. I don't want to add anything to global.asax, I want to do this programmatically in the http module.

However, the HttpApplication instance passed in the Init module does not seem to have an End event. How can I subscribe to the Application_End event?

+4
source share
1 answer

What about:

 AppDomain.CurrentDomain.DomainUnload +=new EventHandler(CurrentDomain_DomainUnload); 

I find this more accurate than Application.End , which should cover recycling.

+3
source

Source: https://habr.com/ru/post/1398064/


All Articles