- Posted On 18 May 2014
- By
- In Programming
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
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.
- Tags :
- ASP.NET
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.
Top 10 Visual Studio things which can boost developers coding speed
Visual Studio 2012 provides some coding features by which you can code faster if use them properly. This post will cover top 10 things among them to boost your development speed.
Visual Studio 2008 Shell and TFS integration
Visual Studio 2008 Shell and TFS integration is the problem for all newbies of BIDS and TFS. Here is the solution.
How to call click or any event only once in jQuery
Know how to execute an click event or any event only once for any element in jQuery. Perform action only once and even not required to unbind event.
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.