Click here to Skip to main content
Click here to Skip to main content

ASP.NET Interview Questions: Part 1

, 27 Aug 2008 CPOL
Rate this:
Please Sign up or sign in to vote.
ASP.NET interview questions: Part 1.

Contents

Introduction

In this section we will touch base on one of important concepts in ASP.NET. You can download my .NET Interview Question PDF from http://www.questpond.com/SampleDotNetInterviewQuestionBook.zip .

I have also put all these design patterns in a video format and uploaded on http://www.questpond.com/FreeDesign1.htm . You can visit http://www.questpond.com and download the complete architecture interview questions PDF which covers SOA, UML, Design Patterns, Togaf , OOPs etc.

You can download the software architecture interview questions PDF here: Download Software Architecture Interview Questions.

Previous parts of my interview questions series for architects:

UML interview questions: Part 1: SoftArch5.aspx

Happy job hunting......

(B) What is the sequence in which ASP.NET events are processed?

Following is the sequence in which the events occur:

  • Page_Init
  • Page load
  • Control events
  • Page unload event

Page_init event only occurs when first time the page is started, but Page Load occurs in subsequent requests of the page.

(B) In which event are the controls fully loaded?

Page load event guarantees that all controls are fully loaded. Controls are also accessed in Page_Init events but you will see that view state is not fully loaded during this event.

(B) How can we identify that the Page is postback?

The Page object has an IsPostBack property which can be checked to know if the page was posted back.

(B) How does ASP.NET maintain state in between subsequent requests?

Refer caching chapter.

(A) What is event bubbling?

Server controls like DataGrid, DataList, and Repeater can have other child controls inside them. For example, DataGrid can have a combobox inside DataGrid. These child controls do not raise their events by themselves, rather they pass the event to the container parent (which can be a DataGrid, DataList, Repeater), which are passed to the page as an ItemCommand event. As the child control sends events to the parent it is termed as event bubbling.

(B) How do we assign page specific attributes?

Page attributes are specified using the @Page directive.

(A) How do we ensure view state is not tampered?

Using the @Page directive and setting the EnableViewStateMac property to true.

(B) What is the use of @Register directives?

@Register directive informs the compiler of any custom server control added to the page.

(B) What is the use of the Smart Navigation property?

It’s a feature provided by ASP.NET to prevent flickering and redrawing when the page is posted back.

Note: This is only supported for the IE browser. Project with browser compatibility requirements have to think of other ways to avoid flickering.

(B) What is the AppSetting section in the Web.Config file?

The Web.config file defines the configuration for a web project. Using the AppSetting section, we can define user-defined values. The example below defines the “Connection String” section which will be used throughout the project for the database connection.

<Configuration>
    <appSettings>
    <add key="ConnectionString" value="server=xyz;pwd=www;database=testing" />
</appSettings>

(B) Where is the ViewState information stored?

In the HTML hidden fields.

(I) What is the use of the @OutputCache directive in ASP.NET?

It is used for caching. See more in the Caching article.

(B) How can we create custom controls in ASP.NET?

User controls are created using .ASCX in ASP.NET. After the .ASCX file is created you need two things so that the ASCX can be used in the project:

  • Register the ASCX control in the page using the <%@ Register directive. Example:
  • <%@ Register tag prefix="Accounting" Tag name="footer" Src="Footer.ascx" %>
  • Now to use the above accounting footer in the page, you can use the below directive:
  • <Accounting: footer runat="server" />

(B) How many types of validation controls are provided by ASP.NET?

There are six main types of validation controls:

  • RequiredFieldValidator: It checks whether the control has any value. It is used when you want the control to not be empty.
  • RangeValidator: It checks if the value in the validated control is in that specific range. Example, TxtCustomerCode should not be more than eight lengths.
  • CompareValidator: It checks that the value in the controls should match some specific value. Example, textbox TxtPie should be equal to 3.14.
  • RegularExpressionValidator: When we want the control, the value should match with a specific regular expression.
  • CustomValidator: It is used to define User Defined validation.
  • ValidationSummary: It displays summary of all current validation errors on an ASP.NET page.

Note: It is rare that someone will ask step by step about all the validation controls. Rather they will ask for what type of validation a validator will be used. For example in one of the interviews I was asked how to display the summary of all errors in a validation control... just uttered one word: ValidationSummary.

(B) Can you explain AutoPostBack?

If we want the control to automatically post back in case of an event, we will need to check this attribute as true. For example, on a ComboBox change, we need to send the event immediately to the server side then set the AutoPostBack attribute to true.

(B) How can you enable automatic paging in DataGrid?

Following are the things to be done in order to enable paging in DataGrid:

  • Set AllowPaging to true.
  • In the PageIndexChanged event set the current page index clicked.

Note: The answers are very short, if you have implemented them practically it is just a revision. If you are a fresher, just make a sample code using a DataGrid and try to implement this functionality.

(B) What is the use of the GLOBAL.ASAX file?

It allows to execute ASP.NET application level events and set application-level variables.

(B) What is the difference between Web.config and Machine.Config?

Web.config files apply settings to each web application, while Machine.config file apply settings to all ASP.NET applications.

(B) What is a SESSION and APPLICATION object?

The Session object stores information between HTTP requests for a particular user, while the Application object is global across users.

Other interview questions PDFs

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Shivprasad koirala
Architect http://www.questpond.com
India India

I am a Microsoft MVP for ASP/ASP.NET and currently a CEO of a small
E-learning company in India. We are very much active in making training videos ,
writing books and corporate trainings. Do visit my site for 
.NET, C# , design pattern , WCF , Silverlight
, LINQ , ASP.NET , ADO.NET , Sharepoint , UML , SQL Server  training 
and Interview questions and answers


Comments and Discussions

 
GeneralMy vote of 3 Pinmemberameenurrahman11-Jun-13 4:51 
QuestionThere is difference between custom control and user control right? Pinmemberganesh.rit25-Mar-13 6:26 
GeneralThanks PinmemberGnanadurai3-Nov-08 4:14 
GeneralRating PinmemberTad McClellan28-Aug-08 14:51 
GeneralRe: Rating PinmemberShivprasad koirala28-Aug-08 20:40 
GeneralRe: Rating PinmemberOlivier Giulieri29-Aug-08 1:29 
GeneralRe: Rating PinmemberRajeev Jayaram9-Mar-12 2:35 
GeneralOnly got as far as the first answer... PinmemberTom John28-Aug-08 3:44 
GeneralRe: Only got as far as the first answer... Pinmemberedwin_vermeer28-Aug-08 8:49 
GeneralRe: Only got as far as the first answer... PinmemberShivprasad koirala28-Aug-08 20:46 
GeneralRe: Only got as far as the first answer... PinmemberJon Holmes14-Oct-08 6:51 
GeneralNot correct question-answer pair about ViewState Pinmembermihasic28-Aug-08 1:52 
GeneralRe: Not correct question-answer pair about ViewState PinmemberShivprasad koirala28-Aug-08 20:41 
GeneralIntresting Questions Pinmembersumit703427-Aug-08 23:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.1411023.1 | Last Updated 28 Aug 2008
Article Copyright 2008 by Shivprasad koirala
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid