ASP.Net State management

Posted on

wqrqwrrqState management in ASP.Net

The state of Web is stateless. Whenever we request a Web page it is recreated every time and is posted back to the server. In conventional web programming, all the information within the page and control gets erased on every postback. To overwhelm this problem, ASP.NET Framework has provided various ways to maintain the states at various stages like controlstate, viewstate, cookies, session, etc. Some of them preserve the state at client side while others at server side.

2r43weewr

Application LifeCycle

In ASP.NET an application is created only when the application is requested for the first time by the web server. Any Application life cycle can have several stages:

  • Stage 1:Request is send to the Webserver for any resource
  • Stage 2:Application receives the very first request from application.
  • Stage 3:Application basic Objects are created.
  • Stage 4:An HTTPapplication object is assigned to the request.
  • Stage 5:And the request is processed by the HTTPApplication

 Stage 1: The first question arises when the Application life cycle get started? The Application life cycle starts when a user hits the URL by typing it in the browser. The browser sends this request to the webserver. Webserver on receiving the request from the browser examines the file extension of the requested file and checks which ISAPI extension is required to handle this request and then passes the request to the appropriate ISAPI extension.If extension is not mapped to any ISAPI extension, ASP.NET will not receive the request and the server will handle the request itself and ASP.NET authentication, etc. will not be applied.A custom handler is created to process any specific file extension.

2r43weewr

Stage 2: As soon as the first request is received by the ASP.Net, the Application manager creates an application domain for it. Application domain providesisolation amongst various applications on the webserver and every application domain is loaded and unloaded separately.An instance of class HostingEnvironment is created in application domain which provides access to information about all application resources.

2r43weewr

Stage 3: Once the application domain and hosting environment are created, ASP.NET initializes the basic objects asHTTPContext, HTTPRequest and HTTPResponse. HTTPContext holds the objects of the specific application request as HTTPRequest and HTTPResponse. All information for the current requested page like cookies, browser information, etc. are contained by HTTPRequestand HTTPResponse contains the response that is sent to client.

Stage 4: This is the stage where all the basic objects are initialized and the application is being started with the creation ofHTTPApplication class, if there is Global.asax in the application, then that is instantiated.

2r43weewr

Stage 5: Lot of events is executed by the HTTPApplication class. These events can be used for any specific requirement. Some of them include-

  • Application_BeginRequest
  • Application_AuthenticateRequest
  • Application _AuthorizeRequest
  • Application_ResolveRequestCache
  • Application_AccquireRequestCache
  • Application_PostrequesthandlerExecute
  • Application_ReoleaseRequestState
  • Application_UpdateRequestCache
  • Application_EndRequest

*****************************************************************************************************

For more details and queries please feel free to email, visit or call us. Wishing you the very best for all your future endeavors.
Helpline: 9814666333, 8699444666
Email: info@technocampus.co.in

Please fill the form and we shall contact you soon.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s