Stages of Page Processing
During Web Forms processing, the page goes through distinct stages, which are illustrated in Figure 3-1. The Web Forms processor calls a corresponding page processing event at each stage.
Figure 3-1. The stages of Web Forms page processing
In ASP pages other than global.asa
, you have to
write your program logic sequentially because your code is executed
in the order in which it appears (termed procedural
programming
). ASP.NET, on the other hand,
features event-driven
programming
, in which the order of execution of
a particular code block is not predetermined. You write a block of
code called an event handler that is executed
whenever that event occurs.
If you’ve developed client-side code or have programmed using Visual Basic, you’re already familiar with event-driven programming. ASP.NET takes event-driven programming to the server side, encouraging you to structure your programming logic into event handlers. In ASP.NET, the Page object is the representation of your ASP.NET page, and you can write handlers at the page level. ASP, on the other hand, supports only events at the application and session levels.
The
Page
class
inherits all of its important events from the
System.Web.UI.Control
class, which is the ultimate parent of all server controls. This means that all events described below also apply to both built-in and custom server controls because ...
Get ASP.NET in a Nutshell 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.