How do I write custom code that runs on server start?
I need to declare an instance of a custom class and add it to the Application collection as soon as our ASP.NET site starts on the server.
So far, we have it doing it on the first page load of a master page, but tha开发者_如何学JAVAt can take a few seconds because this class is a little intensive, so the first user is required to wait a couple seconds while the web server completes its task.
So where do I need to go to do this?
Look at the Global.asax page events, it is has what you need.
This should be helpfull
http://msdn.microsoft.com/en-us/library/ms178473.aspx
Global.asax is the place to do it
Application_Start in Global.asax
精彩评论