- Posted On 18 May 2014
- 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.
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.
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.
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.
If it’s postback request then this is the stage where control properties are loaded with information retrieved from view state and control state
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.
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.
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 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.
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.
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.
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.
Speed up coding in Visual Studio with code snippets & samples at your fingertips
Know how you can speed up coding in Visual Studio with Bing Developer Assistant by having millions of code snippets and sample projects at fingertips.