The Life Cycle of an ASP.NET Page

Whenever a Web visitor requests a page with an .aspx file name extension, ASP.NET examines each HTML or XML tag in the page and looks for the attribute runat="server". If this attribute is present, ASP.NET loads the tag into memory as an object called, generically, a server control. Otherwise, ASP.NET loads the tag into memory as ordinary text.

After the entire page is loaded into memory, ASP.NET runs any event handlers for which events actually occurred. Some of these events—such as those listed in Table 12-2—occur every time a page executes. Others—such as button clicks—occur only if the Web visitor initiates them.

Table 12-2. Common Page Object Events

Event

Event Handler

Description

Init

Page_Init

Get Faster Smarter Beginning Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.