You may recall that an "application" in ASP.NET is essentially all of the physical parts that sit in an IIS application, either from the site root or a subfolder marked as an application in its IIS property sheet. This application, running as an instance of HttpApplication, has a number of events that occur throughout the life of a request. These are intermingled with events that happen in the life of the Page object, created every time a request for a page is made. A number of methods also fire in the life of a Page. Some of the more relevant events and methods in the life of a page request are shown in Table 7.1.
HttpApplication | Page | Control |
---|---|---|
BeginRequest | ||
AuthenticateRequest | ||
AuthorizeRequest | ||
ResolveRequestCache | ||
Page Constructor fires | ||
AcquireRequestState | ||
PreRquestHandlerExecute | ||
CreateControlCollection | ||
method | Init | |
trackViewState method | ||
Init | ||
TRackViewState method | ||
LoadViewState method | ||
Load | ||
DataBind | ||
Load | ||
Postback event handler methods | ||
PreRender | ||
SaveViewState method | ||
SaveViewState method | ||
Render method | ||
RenderControl method | ||
Unload | ||
Dispose | ||
Unload | ||
Dispose | ||
ReleaseRequestSate | ||
UpdateRequestCache | ||
EndRequest |
You can see from this table that a lot is going on from the time a request comes in to the server to the time a response is sent back to the browser. This doesn't even count many of the less frequently used events, especially at the application level.
Some events are more useful than others. You already know all about the Page's Load event because ASP.NET looks for a method in your code called Page_Load(). This event is wired up for you to facilitate your basic interaction with the event sequence.