I’m implementing a simple HttpModule, where I want some code to run when the web application is started. But I’m surprised to find that the Application_Start event I would n
As a matter of fact, there is, and always will be only one instance of specific http module until application pool recycle. And, of course, per w3wp.exe worker of you web application.
In other words, use init method or constructor to do initialisation, preload data etc. ;) and don't use static fields except you need to do locking once requests start firing events your module subscribed to and you need change data your module controls or contains as properties. Anyhow, init method is called on application start.