ASP.Net life cycle Assignment Help

Assignment Help: >> ASP.Net Programming >> ASP.Net life cycle

ASP.Net life cycle:

ASP.Net life cycle defines, how:

  • ASP.Net processes pages to give dynamic output
  • The application and its pages are processed and instantiated
  • ASP.Net compiles the pages dynamically

The ASP.Net life cycle would be spited into two groups:

1.     Application Life Cycle

2.     Page Life Cycle

ASP.Net Application Life Cycle:

The application life cycle has the given steps:

  • User creates a request for accessing application resource, Browser, a page sends this request to the server.
  • A unified pipeline gets the first request and the following components take place:
    • An object of the ApplicationManager class is started.
    • An object of the HostingEnvironment class is prepared to give information related to the resources.
    • Top level items in the application are compiled.
  • Response objects are prepared. the application objects: HttpContext, HttpResponse and HttpRequest are prepared and initialized.
  • An instance of the HttpApplication object is prepared and assigned to the request. The request is operated by the HttpApplication class. Different events are raised by this class for executing the request.

ASP.Net Page Life Cycle:

When a page is requested, it is loaded into the processed, server memory and sent to the browser. Then it is unloaded from the primary memory. At each of this steps, events and methods are available, which should be overridden according to the requirement of the application. In other words, you may write your own code to override the default programming code.

The Page class prepares a hierarchical tree of all the controls on the page. All the elements on the page, except the directives are part of that control tree. You may see the control tree by adding trace= "true" to the Page directive. We will face page directives and tracing under 'error handling' and 'directives'.

The page life cycle has basic steps:

  • Initialization
  • Instantiation of the controls on the page
  • Restoration and maintenance of the state
  • Execution of the event handler codes
  • Page rendering

Understanding the page cycle helps in writing codes for creating some specific thing occurred at any stage of the page life cycle. It also helps in writing custom controls and starting them at right time, populate their properties with run control behavior code and view-state data.

Following are the different steps of an ASP.Net page:

  • Page request . when ASP.Net takes a page request, it operates whether to parse and compile the page or there could be a cached version of the page; accordingly the response is forwarded
  • Starting of page life cycle . at this stage, the Request and Response objects are fixed. If the request is a post back or old request, the IsPostBack property of the page is set to true. The UICulture property of the page is also set to true.
  • Page initialization . at this step, the controls on the page are given unique ID by setting the UniqueID property and themes are applied. For a new request postback data is created and the control properties are stored to the view-state values.
  • Page load . at this stage, control properties are set needing the view state and control state values.
  • Validation . Validate function of the validation control is invoked and if it runs successfully, the IsValid property of the page is set to active.
  • Postback event handling . if the request is a postback or old request, the related event handler is invoked.
  • Page rendering . at this stage, view state for the page and all controls are stored. The page calls the Render function for each control and the output of rendering is set to the OutputStream class of the Page's Response property.
  • Unload . the rendered page is forwarded to the client and page properties, such as Request and Response are unloaded and all cleanup done.

ASP.Net Page Life Cycle Events:

At each steps of the page life cycle, the page raises some code, which should be coded. An event handler is basically a function or subroutine, correlated to the event, using declarative attributes like Onclick or handle.

Given the page life cycle events:

  • PreInit . PreInit is the first event in page life cycle. It selects the IsPostBack property and calculates whether the page is a postback. It sets the themes and master pages, prepares dynamic controls and sets and gets profile property values. This event may be handled by overloading the OnPreInit function or preparing a Page_PreInit handler.
  • Init . Init event initializes the control property and the control tree is prepared. This event may be handled by overloading the OnInit function or creating a Page_Init handler.
  • InitComplete . InitComplete event gives tracking of view state. All the controls operate view-state tracking.
  • LoadViewState . LoadViewState event gives loading view state information into the controls.
  • LoadPostData . during this step, the contents of all the input fields described with the <form> tag are processed.
  • PreLoad . PreLoad happens before the post back data is loaded in the controls. This function may be handled by overloading the OnPreLoad function or creating a Page_PreLoad handler.
  • Load . the Load event is elevated for the page first and then recursively for all child controls. The controls in the control tree are build. This event may be handled by overloading the OnLoad method or preparing a Page_Load handler.
  • LoadComplete . the loading process is ended, control event handlers are executed and page validation takes place. This event may be handled by overloading the OnLoadComplete function or creating a Page_LoadComplete handler.
  • PreRender . the PreRender event happens just before the output is rendered. By handling that part, pages and controls may operate any updates before the output is rendered.
  • PreRenderComplete . as the PreRender event is recursively run for all child controls, that part ensures the ending of the pre-rendering phase.
  • SaveStateComplete . state of control on the page is stored. Personalization, control state and view state information is stored. The HTML markup is prepared. This stage may be handled by overriding the Render function or creating a Page_Render handler.
  • UnLoad . the UnLoad phase is the last phase of the page life cycle. It gains the UnLoad event for all controls recursively and lastly for the page itself. Final cleanup is submitted and all resources and references, such as database connections, are open. This event may be handled by changing the OnUnLoad method or creating a Page_UnLoad handler.

 

Email based ASP.Net assignment help - homework help at Expertsmind

Are you searching ASP.Net expert for help with ASP.Net life cycle questions?  ASP.Net life cycle topic is not easier to learn without external help?  We at www.expertsmind.com offer finest service of ASP.Net assignment help and ASP.Net homework help. Live tutors are available for 24x7 hours helping students in their ASP.Net life cycle related problems. Computer science programming assignments help making life easy for students. We provide step by step ASP.Net life cycle question's answers with 100% plagiarism free content. We prepare quality content and notes for ASP.Net life cycle topic under ASP.Net theory and study material. These are avail for subscribed users and they can get advantages anytime.

Why Expertsmind for assignment help

  1. Higher degree holder and experienced experts network
  2. Punctuality and responsibility of work
  3. Quality solution with 100% plagiarism free answers
  4. Time on Delivery
  5. Privacy of information and details
  6. Excellence in solving ASP.Net queries in excels and word format.
  7. Best tutoring assistance 24x7 hours

 

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd