ASP.NET Interview Questions
Tue Jan 11 2011 by MarkP
I recently completed a contract and have now been looking at the job market for the last week. Whilst being successful in getting interviews I have realised my interview technique needs improvement and also need to "brush up" on my basic ASP.NET concepts particulary in relation to Web forms development. I realised questions I could answer 2-3 years ago I have struggled with recently. The main reason is that I have spent a lot of time researching new technologies and techniques aswell as working on mainly core systems development and integration - ask me a question of Domain Driven Design or the differences between abstract classes and interfaces and this would be no problem - ask me about the ASP.NET page lifecycle or different caching techniques and I struggle even though I have been working with the technology for many years. With this in mind I have decided to create a list of key points in relation to ASP.NET to ensure I do not fall over on such questions in the future.
Define the ASP.NET Page Life Cycle?
This question comes up frequently and whilst being familar with the core concepts relating to intialisation, page loading and page rendering have forgotten some of the finer details relating to full page life cycle.
Details are as follows:
The page cycle commences when the ProcessRequest() Method is called:
- Page Pre Initialisation -> Page.PreInit (Access to Master Pages and Themes)
- Page Initialisation –> Page.Init
- Initialisation Complete -> Page.InitComplete
- Viewstate Loading -> Page.LoadViewState
- Postback Data Processing -> Page.LoadPostData
- Pre Load -> Page.PreLoad
- Page Loading -> Page.Load
- Postback Change Notification -> RaisePostDataChangedEvent
- Postback Event Handling -> RaisePostBackEvent
- Load Complete -> Page.LoadComplete
- Page Pre Rendering Phase -> Page.PreRender
- Pre Render Complete -> Page.PreRenderComplete
- View State Saving -> Page.SaveViewState
- Save Control State -> Page.SaveControlState
- Page Rendering -> Page.Render
- Page Unloading -> Page.Unload
Describe the caching techniques available in the ASP.NET Framework?
Key types of caching in a ASP.NET application are : Page Caching (page aspx), Fragment caching (user controls ascx) and Object caching (API) (in memory cache)
All cached objects are stored in the AppDomain and are avialable to all users accessing the application. Page and Fragment caching is set using the directive at the top of the aspx page/ascx user control as follows:
@OutputCache Duration="60" VaryByParam="None"
Decribe the different modes Session state can be stored and how it is configured?
Session state is available to each user visiting the application, who can be uniquely identified by the SessionID. The following modes can set for session in the web.config file:
- InProc mode, which stores session state in memory on the Web server. This is the default.
- StateServer mode, which stores session state in a separate process called the ASP.NET state service. This ensures that session state is preserved if the Web application is restarted and also makes session state available to multiple Web servers in a Web farm.
- SQLServer mode stores session state in a SQL Server database. This ensures that session state is preserved if the Web application is restarted and also makes session state available to multiple Web servers in a Web farm.
- Custom mode, which enables you to specify a custom storage provider.
- Off mode, which disables session state.
I expect to be adding to this over the next few weeks, to ensure I have all areas covered and not caught out again in the future.


