Web Forms Page / Control Events and Sequence

Web Forms Page / Control Events and Sequence

What are Web Forms

Web Forms was the first Dot Net ASP.Net Web Framework. The technology was the easiest way for existing Microsoft Platform developers to move to the web.

ASP.NET Web Forms is a part of the ASP.NET web application framework and is included with Visual Studio. It is one of the four programming models you can use to create ASP.NET web applications, the others are ASP.NET MVC, ASP.NET Web Pages, and ASP.NET Single Page Applications.

Web Forms are pages that your users request using their browser. These pages can be written using a combination of HTML, client-script, server controls, and server code. When users request a page, it is compiled and executed on the server by the framework, and then the framework generates the HTML markup that the browser can render. An ASP.NET Web Forms page presents information to the user in any browser or client device.

Using Visual Studio, you can create ASP.NET Web Forms. The Visual Studio Integrated Development Environment (IDE) lets you drag and drop server controls to lay out your Web Forms page. You can then easily set properties, methods, and events for controls on the page or for the page itself. These properties, methods, and events are used to define the web page’s behavior, look and feel, and so on. To write server code to handle the logic for the page, you can use a .NET language like Visual Basic or C#.

What are Web Form Events

With web forms, there is a flow of events that are triggered as pages are processed by the underlying ASP.Net framework. There are common page events, user control (parts of pages), and control events. The list below shows the standard events and the sequence in which they fire.

The main event – get it?

BeginRequest - HttpModule

AuthenticateRequest - HttpModule

PostAuthenticateRequest - HttpModule 

PostAuthorizeRequest - HttpModule

ResolveRequestCache - HttpModule

PostResolveRequestCache - HttpModule

PostMapRequestHandler - HttpModule

AcquireRequestState - HttpModule

PostAcquireRequestState - HttpModule

PreRequestHandlerExecute - HttpModule

PreInit - Page

Init - ChildUserControl

Init - UserControl

Init - MasterPage

Init - Page

InitComplete - Page

LoadPageStateFromPersistenceMedium - Page 

ProcessPostData (first try) - Page

PreLoad - Page

Load - Page

Load - MasterPage

Load - UserControl

Load - ChildUserControl

ProcessPostData (second try) - Page

RaiseChangedEvents - Page

RaisePostBackEvent - Page

Click - Button - ChildUserControl

    DataBinding - Page

    DataBinding - MasterPage

    DataBinding - UserControl

    DataBinding - ChildUserControl

LoadComplete - Page

PreRender - Page

PreRender - MasterPage

PreRender - UserControl

PreRender - ChildUserControl

PreRenderComplete - Page

SaveViewState - Page

SavePageStateToPersistenceMedium - Page

SaveStateComplete - Page

Unload - ChildUserControl

Unload - UserControl

Unload - MasterPage

Unload - Page

PostRequestHandlerExecute - HttpModule

ReleaseRequestState - HttpModule

PostReleaseRequestState - HttpModule

UpdateRequestCache - HttpModule

PostUpdateRequestCache - HttpModule

EndRequest - HttpModule

PreSendRequestHeaders - HttpModule

PreSendRequestContent - HttpModule

Stephen

Hi, my name is Stephen Finchett. I have been a software engineer for over 30 years and worked on complex, business critical, multi-user systems for all of my career. For the last 15 years, I have been concentrating on web based solutions using the Microsoft Stack including ASP.Net, C#, TypeScript, SQL Server and running everything at scale within Kubernetes.