Have you ever wondered about all the stages that an ASP.NET request goes through? Ever wonder why it is such a performance hit to have a wildcard mapping to map all extensions on your web server to ASP.NET? This information corresponds to IIS 5.0 and 6.0. For information on the life cycle in IIS 7.0, see ASP.NET Application Life Cycle Overview for IIS 7.0. You can also check out the ASP.NET Page Life Cycle Overview for information on what happens once a page is run.
A request comes into the web server and it will check to see what is mapped to handle the request. ASP.NET is an ISAPI extension under the web server.
ASP.NET will first create the application domain for this application. These allow each application to be isolated from each other. ASP.NET then compiles all the top-level items in the application, if required, including the App_Code folder.
ASP.NET will create the Request, Response, and Context objects for the request. This includes browser information, cookies, headers and everything that the server will respond back to the client with.
The application is started by creating the HttpApplication object, taking into account the Global.asax file if it exists. At this stage, ASP.NET will create any configured modules, such as SessionStateModule to handle Session.
The following events occur:
Hopefully this will give you a little perspective on all of the different times that you can hook into a request and the different things you can act on. There are additional things you can do, such as Application_Start events in the global.asax file. For those and some nice pictures of some of the above data, take a look at the MSDN page here.