PageLifeCycle of ASP.NET

Category: Education

Presentation Description

No description available.


Presentation Transcript

ASP.NET Page life cycle:

ASP.NET Page life cycle By Prof.Jayshri G.Ingale

PowerPoint Presentation:

Jayshri G.Ingale

PowerPoint Presentation:

Jayshri G.Ingale Before learning the life cycle we have to keep in mind the following terms One browser is acting as one client. hence for e.g. if our PC having 3 browsers our PC having 3 clients. ASP.NET is a server side Language , hence execution of code will take place when our page & its data will visit the Server. . aspx page contain all server side controls Browser knows only HTML. hence if I want to show any . aspx page on browser I have to convert all the Server side controls into HTML Controls.

A Web Form in ASP.NET :

A Web Form in ASP.NET <form id="form1" runat="server"> < asp:Label ID ="Label1" runat ="server" T ext ="A Label!"/> < asp: TextBox ID ="TextBox1" runat ="server" T ext ="A Text"/> < asp:Button ID ="Button1" runat ="server“ onClick ="Label1.text='Hello'"/> </form> Jayshri G.Ingale

After Server-side Processing:

After Server-side Processing TextBox1 produces: < input type ="Text" id ="TextBox1" name ="TextBox1" value ="A Text"/> We can see these changes in every tag when we open the above mentioned webpage in any browser. How these changes happens??? Jayshri G.Ingale

Page Life Cycle :

Page Life Cycle The conversion of each server side control tag into pure HTML control tag is done in Page Life Cycle. Jayshri G.Ingale

Stages of Page Life Cycle:

Stages of Page Life Cycle Page request :- When the page is requested by a user, ASP.NET determines whether the page needs to be parsed and compiled (therefore beginning the life of a page), OR whether a cached version of the page can be sent in response without running the page. Jayshri G.Ingale

PowerPoint Presentation:

Start :- the page also determines whether the request is a postback or a new request and sets the  IsPostBack  property. page properties such as  Request  and  Response  are set. Page initialization:- During page initialization, controls on the page are available and each control's  UniqueID  property is set. Any themes are also applied to the page Jayshri G.Ingale

PowerPoint Presentation:

Load:- During load, if the current request is a postback , control properties are loaded with information recovered from view state and control state. Validation:- During validation , Page will be validated. It verifies whether User put all the correct information Postback event handling:- If the request is a postback , any event handlers are called. Rendering:- Render method generates HTML Tags for all the ASP.NET control Tags Also write the Text if any using Response property. Jayshri G.Ingale

PowerPoint Presentation:

Unload:- Unload request & response objects . Page is ready to be discarded from server’s Random access memory. Jayshri G.Ingale

User requests an application resource from the Web server.:

User requests an application resource from the Web server. The life cycle of an ASP.NET application starts with a request sent by a browser to the Web server ASP.NET is an ISAPI extension under the Web server. When a Web server receives a request, it examines the file-name extension of the requested file, determines which ISAPI extension should handle the request, and then passes the request to the appropriate ISAPI extension . ASP.NET handles file name extensions that have been mapped to it, such as . aspx , . ascx , . ashx , and . asmx . Jayshri G.Ingale

PowerPoint Presentation:

Jayshri G.Ingale

ASP.NET receives the first request for the application.:

ASP.NET receives the first request for the application. When ASP.NET receives the first request for any resource in an application, a class named ApplicationManager  creates an application domain . Within an application domain, an instance of the class named  HostingEnvironment  is created, which provides access to information about the application such as the name of the folder where the application is stored. Jayshri G.Ingale

ASP.NET core objects are created for each request.:

ASP.NET core objects are created for each request. After the application domain has been created and the  HostingEnvironment  object instantiated, ASP.NET creates and initializes core objects such as  HttpContext ,  HttpRequest , and  HttpResponse .  The  HttpContext  class contains objects that are specific to the current application request, such as the  HttpRequest  and  HttpResponse  objects. Jayshri G.Ingale

PowerPoint Presentation:

Jayshri G.Ingale

An HttpApplicationobject is assigned to the request:

An HttpApplication object is assigned to the request After all core application objects have been initialized, the application is started by creating an instance of the  HttpApplication  class. The first time an ASP.NET page or process is requested in an application, a new instance of  HttpApplication  is created. However, to maximize performance,  HttpApplication  instances might be reused for multiple requests.

authorStream Live Help