Working with ASP.NET Events

ASP.NET implements a set of events that indicate different stages in the life cycle of a web application. We touched on one such event in the previous chapter, when we added C# statements to the Page_Load method of our code-behind class and relied on the auto event wire-up feature to associate this method with the Page.Load event. In this section, we’ll dig deeper into these events to understand what they represent and how they can be used.

Page Events

The first kind of ASP.NET events we will look at are page events. These events are invoked as the ASP.NET server processes a request for page. You can register a handler for page events in your code-behind class to respond to the different parts of the life cycle.

Get Applied ASP.NET 4 in Context 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.