Subscribe - It's FREE!!

Stay Connected Here

Stay Updated With Us Here



Google

Understand ASP.NET Page life cycle and remember stages in easy way


Share with WhatsApp


Understand ASP.NET Page life cycle and remember stages in easy way


Hello friend, in this post I am going to share tips or my style of remembering ASP.NET page life cycle. Some of you might already use this style but still sharing for them who are not aware of this.

Since my school days I am using this technique to remember long answers questions and it was really worked for my entire study and still benefitting in cracking interviews. Though, technical interviews are not like mug up and write as it requires real understanding but still most of the time you can win the moment for particular question like ASP.NET page life cycle if you are able to tell all stages in sequence with confidence. It really helps a lot.

So let’s start.

With reference to the MSDN below are the stages or phases through which ASP.NET page goes.

1) Request

When the page is requested by a user, ASP.NET determines whether the page needs to be parsed and or whether a cached version of the page can be sent in response without running the page.

2) Start

At Start phase, page properties such as Request and Response are set. Depends on the request type i.e. New or Postback sets value to the IsPostBack property.

3) Initialization

In third phase i.e. page initialization, UniqueID property of control is set and if any themes available then it gets applied to the page. If the current request is a postback, the postback data has not yet been loaded and control property values have not been restored to the values from view state.

4) Load

If it’s postback request then this is the stage where control properties are loaded with information retrieved from view state and control state

5) Validation

 In this phase, IsValid property of individual validator controls and of the page set by calling Validate method of all validator.

6) Postback event handling

 If the request is a postback, any event handlers are called.

7) Rendering

Before rendering, view state is saved for the page and all controls. During the rendering phase, the page calls the Render method for each control, providing a text writer that writes its output to the OutputStream of the page's Response property.

8) Unload

Unload is called after the page has been fully rendered, sent to the client, and is ready to be discarded. At this point, page properties such as Response and Request are unloaded and any cleanup is performed.


If you have read all above stages of ASP.NET life cycle then you can see I haven’t mentioned the events because if you are able to tell this it’s sufficient to show that you know ASP.NET page life cycle very well. But if interviewer has asked about page events then tell events only.

Coming to the point how to remember this, I usually prepare a code for such long answers (this is not so long but still) rather remembering full answer remembering code is very easy I feel and it also helps you to write or say your answer in points and i.e. too in sequence.

For ASP.NET Page life cycle I remembered the following code

R-SIL-VP-RU

Meaningless but Short and easy to remember, isn’t it?

I have taken starting letter of each stage name e.g. R for Request, S for Start and so on. In above answer sequence is very important so code is like that but where sequence is not important you can create some meaningful code which will help you to recall everything.

I hope you have benefitted by reading this post. Do share with your friends if found useful.



If you enjoyed this post take 5 seconds to share it! Be Socialable. :-)

Share with WhatsApp

Posts To Read Next

Asp.Net Interview Questions and Answers for Experienced Developers - Part One

Asp.net Interview Questions for experienced developers with answers you will read in this post. These questions were faced by me in my last job hunt so you will surely get benefited after reading this post.


Typewriter - Automatic TypeScript Template generation from C# classes in Visual Studio

Typewriter, an extension for visual studio that generates TypeScript files from C# code files using TypeScript templates. Convert your C# model classes to TypeScript automatically.


Swagger - Powerful Opensource Framework for RESTful API

With a Swagger-enabled API, you get interactive documentation, client SDK generation and discoverability. Swagger Editor allows you to generate code, documentation with ease.


Visual Studio Code - Lighweight but powerful source code editor available for Windows, OS X and Linux

Visual Studio Code is a lightweight but powerful source code editor which runs on your desktop and is available for Windows, OS X and Linux. It comes with built-in support for JavaScript, TypeScript and Node.js and has a rich ecosystem of extensions for other languages (C++, C#, Python, PHP) and runtimes.


Assembla - Free and private repository to manage your source code online with SVN subversion hosting

With Assembla you can share source code with others online. Free & Private source code repository with SVN Subversion, Git & Perforce Hosting.


Your opinion is valuable for us! Comments, suggetions are welcome.


Submit your Email Id to stay updated with us and get notified with our new posts. It's FREE!
Vu 32'' TV Vu 24'' TV
We know this popup is disturbing you!
But We would greatly appreciate if you share us with your friends below!

It will not take more than 2 seconds but will motivate us greatly to write more,share more!

x