Reputation: 1800
I have some code that I want to force to run whenever my IIS app gets reloaded, stopped or any other event that would reset the state of some static properties in a business class.
I've made the class implement IDisposable and I tried adding a class destructor, but neither run when I upload a new dll to the server. How can I, from inside this class, register a method to run before the application is unloaded?
Upvotes: 2
Views: 1414
Reputation: 85116
I would look at the events in Global.asax. This is typically where you will handle application level events. Here are a few links to get you started:
Application_Init or Application_Start might be good for your purposes?
Upvotes: 2