ASP.NET Supports Web Services - Describing an ASP.NET Page’s Life Cycle
(Page 5 of 5 )
Examining a Page’s life cycle is the next step. By doing so, we will add to our knowledge of ASP.NET pages. Each ASP.NET page contains a server-side <form> tag. This tag instructs the page to post back to itself when a client submits the form. The Form type events include Load, Draw, Render, and Unload.
ASP.NET controls also render JavaScript to the client, enabling actions such as selecting a specified item from a drop-down list, causing a post-back to the server. The ASP.NET runtime renders a hidden field to the page permitting it to preserve state between client requests. Because ASP.NET is event-driven, client and page interaction allows the page to be re-constructed on the server. It also facilitates code execution in response to events raised by users and any changes occurring in the hidden fields. Here is the page lifecycle processed step-by-step. The figure displayed here illustrates an ASP.NET’s page lifecycle.

Figure 1 The ASP.NET lifecycle
- The initial event begins with an HTTP URL client request for rendering a specified page to the client’s browser.
- The Load event fires next. The CLR uses reflection to examine the .aspx page and determine whether the page is called for the first time, or represents a post back through user interaction with a button or some other page control.
- If the event is a first-time request, the code is converted to a class.
- The class compiles to an assembly and is stored in a valid Internet Information Server virtual directory where the page’s location can be determined.
- If the page is posted back, ASP.NET restores any data residing in hidden fields (ViewState) and passes the information to the server.
- The control event triggering the post back fires. At this stage, all control events are initiated. The change events fire first; those events are stored in the browser and execute only when the client sends the page back to the server. After a control event fires, the page is rendered to the browser.
- Before Page_Unload unloads the page from server memory, a final event performs any cleanup tasks before the unload method disposes the page.
Many other features are supported in ASP.NET by the Common Language runtime. They include Web Forms, the new programming model for ASP.Net, Server Controls, Web Services, Caching, and Configuration improvements.
In the next article we will focus on the enhanced session-state management model in ASP.NET, as well as taking a look at Page Directives. We’ll meet again in the next article. Happy Explorations in ASP.NET.
References
1. .NET & J2EE Interoperability, McGraw-Hill, 2004.
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |