Header Ads Widget

Ticker

6/recent/ticker-posts

What is ASP.Net Lifecycle?

When an ASP.Net application is launched, there are series of steps which are carried out. These series of steps make up the lifecycle of the application.

Let's look at the various stages of a typical page lifecycle of an ASP.Net Web Application.

1) Application Start - The life cycle of an ASP.NET application starts when a request is made by a user. This request is to the Web server for the ASP.Net Application. This happens when the first user normally goes to the home page for the application for the first time. During this time, there is a method called Application_start which is executed by the web server. Usually, in this method, all global variables are set to their default values.

2) Object creation - The next stage is the creation of the HttpContext, HttpRequest & HttpResponse by the web server. The HttpContext is just the container for the HttpRequest and HttpResponse objects. The HttpRequest object contains information about the current request, including cookies and browser information. The HttpResponse object contains the response that is sent to the client.

3) Http Application creation - This object is created by the web server. It is this object that is used to process each subsequent request sent to the application. For example, let's assume we have 2 web applications. One is a shopping cart application, and the other is a news website. For each application, we would have 2 HttpApplication objects created. Any further requests to each website would be processed by each HttpApplication respectively.

Read More Under ASP.Net Tag

4) Dispose - This event is called before the application instance is destroyed. During this time, one can use this method to manually release any unmanaged resources.

5) Application End - This is the final part of the application. In this part, the application is finally unloaded from memory.

Post a Comment

0 Comments