I've got a piece of code that I want to run one time when my website is first loaded. It is basically a static initialization of another module.
Is there some event I can hook into that runs when the site is first served to a client? It doesn't even need to be per session, just on first load to any client.
I'm using vs2010, .net 4.0, asp.net 4.0
You can use the Application_Start event.
See MSDN ASP.NET Application Life Cycle Overview
Application_Start is Called when the first resource (such as a page) in an ASP.NET application is requested. The Application_Start method is called only one time during the life cycle of an application. You can use this method to perform startup tasks such as loading data into the cache and initializing static values.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With