ASP .NET Interview Questions and Answers

81. Which namespaces are necessary to create a localized application?

The System.Globalization and System.Resources namespaces are essential to develop a localized application.

82. What is the difference between an HtmlInputCheckBox control and an HtmlInputRadioButton control?

You can select more than one HtmlInputCheckBox control from a group of HtmlInputCheckBox controls; whereas, you can select only a single HtmllnputRadioButton control from a group of HtmlInputRadioButtoncontrols.

83. What is the difference between HTML and Web server controls?

HTML controls are client-side controls; therefore, all the validations for HTML controls are performed at the client side. On the other hand, Web server controls are server-side controls; therefore, all the validations for Web server controls are performed at the server side.

84. Explain the AdRotator Control.

The AdRotator is an ASP.NET control that is used to provide advertisements to Web pages. The AdRotator control associates with one or many advertisements, which randomly displays one by one at a time when the Web page is refreshed. The AdRotator control advertisements are associated with links; therefore, when you click on an advertisement, it redirects you to other pages.

The AdRotator control is associated with a data source, which is normally an xml file or a database table. A data source contains all the information, such as advertisement graphics reference, link, and alternate text. Therefore, when you use the AdRotator control, you should first create a data source and then associate it with theAdRotator control.

85. What do you understand by the culture?

The culture denotes a combination of a language and optionally a region or a country. The contents of a Web page of a multilingual Web site are changed according to the culture defined in the operating system of the user accessing the Web page.

86. What is the difference between absolute expiration and sliding-time expiration?

The absolute expiration expires a cached item after the provided expiration time. The sliding time does not expire the cached items because it increments the specified time.

87. What is the code-behind feature in ASP.NET?

The code-behind feature of ASP.NET enables you to divide an ASP.NET page into two files – one consisting of the presentation data, and the second, which is also called the code-behind file, consisting of all the business logic. The presentation data contains the interface elements, such as HTML controls and Web server controls, and the code-behind contains the event-handling process to handle the events that are fired by these controls. The file that contains the presentation data has the .aspx extension. The code behind file has either the .cs extension (if you are using the programming language C#) or the .vb (if you are using the programming language Visual Basic .NET) extension.

88. How can you check if all the validation controls on a Web page are valid and proper?

You can determine that all the validation controls on a Web page are properly working by writing code in the source file of the Web page using a scripting language, such as VBScript or JavaScript. To do this task, you have to loop across validators collection of pages and check the IsValid property of each validation control on the Web page to check whether or not the validation test is successful.

89. Explain the validation controls. How many validation controls in ASP.NET 4.0?

Validation controls are responsible to validate the data of an input control. Whenever you provide any input to an application, it performs the validation and displays an error message to user, in case the validation fails.

ASP.NET 4.0 contains the following six types of validation controls:

  • CompareValidator – Performs a comparison between the values contained in two controls.
  • CustomValidator – Writes your own method to perform extra validation.
  • RangeValidator– Checks value according to the range of value.
  • RegularExpressionValidator – Ensures that input is according to the specified pattern or not.
  • RequiredFieldValidator – Checks either a control is empty or not.
  • ValidationSummary – Displays a summary of all validation error in a central location.

90. What is difference between a Label control and a Literal control?

The Label control’s final html code has an HTML tag; whereas, the Literal control’s final html code contains only text, which is not surrounded by any HTML tag.

91. How many types of Cookies are available in ASP.NET?

There are two types of Cookies available in ASP.NET:

  • Session Cookie – Resides on the client machine for a single session until the user does not log out.
  • Persistent Cookie – Resides on a user’s machine for a period specified for its expiry, such as 10 days, one month, and never.

The user can set this period manually.

92. What is the use of the Global.asax file?

The Global.asax file executes application-level events and sets application-level variables.

93. What are the Culture and UICulture values?

The Culture value determines the functions, such as Date and Currency, which are used to format data and numbers in a Web page. The UICulture value determines the resources, such as strings or images, which are loaded for a Web page in a Web application.

94. What is the difference between ASP session and ASP.NET session?

ASP does not support cookie-less sessions; whereas, ASP.NET does. In addition, the ASP.NET session can span across multiple servers.

95. Which control will you use to ensure that the values in two different controls match?

You should use the CompareValidator control to ensure that the values in two different controls match.

96. What is the difference between a page theme and a global theme?

A page theme is stored inside a subfolder of the App_Themes folder of a project and applied to individual Web pages of that project. Global themes are stored inside the Themes folder on a Web server and apply to all the Web applications on the Web server.

97. What do you mean by a neutral culture?

When you specify a language but do not specify the associated country through a culture, the culture is called as a neutral culture.

98. What is the use of the <sessionState> tag in the web.config file?

The <sessionState> tag is used to configure the session state features. To change the default timeout, which is 20 minutes, you have to add the following code snippet to the web.config file of an application: <sessionState timeout=”40″/>

99. Can you post and access view state in another application?

Yes, you can post and access a view state in other applications. However, while posting a view state in another application, the PreviousPage property returns null.

100. Which method do you use to kill explicitly a users session?

The Session.Abandon() method kills the user session explicitly.

2 thoughts on “ASP .NET Interview Questions and Answers”

  1. Hi! I just wish to give you a big thumbs up for the great info you have here on this post. I will be returning to your web site for more soon.

Leave a Comment

Your email address will not be published. Required fields are marked *

%d bloggers like this: