If you are trying to get a web-developer job, then you should also have the knowledge of ASP.Net besides other web-development tools. Here in the post some important ASP.Net interview questions and answers are given for preparation of interview.
1) What is ASP?
ASP stands for Active Server Pages. It is a server-side technology of Microsoft Company used to develop dynamic web pages and also use different scripting languages like VBScript for creating web pages.
2) What is ASP.Net?
First version of ASP.Net was released in the year 2002 by Microsoft in direct response to the problems that developers being faced in classic ASP. Since at that time ASP is in such wide use, therefore, Microsoft ensured that ASP scripts execute without modification on a machine with the .NET Framework. Now, it is a part of .Net Framework. ASP.Net applications can be created in most of .Net compatible languages like Visual Basic, C# and J# etc.
3) Name the parent class of the web server control?
The parent class of all web server controls is System.Web.UI.Control.
4) What are types of caching in ASP.Net?
In ASP.Net has following types of caching.
- Output caching
- Fragment caching
- Data caching
5) What is cross-page posting?
By default, ASP.Net submits form to the same page while in case of cross-page posting, the form is submitted to different pages. It is done with the help of PostBackUrl property of the button.
6) What are HTML server controls?
HTML server controls are enhanced form of HTML standard controls. The HTML controls are not processed by the server To make use of it, these are specifically converted into server control with the help of attribute runat=”server”.
For example, the following is standard HTML control.
<input type="text" color="green">
After adding an attribute to convert it to a server control, it will be as under.
<input type="text" id="textid" color="green" runat="server">
7) What are the names of events in page-life-cycle?
8) What is the purpose of Http Protocol?
HTTP Protocol is used to call web service.
9) What are ASP.Net security controls?
Following are ASP.Net security controls. All of them serve different purpose.
<asp:Login>: It allows the users to enter their credentials
<asp:LoginName>: Used to display the name of the logged-in user
<asp:LoginStatus>: Shows as to whether user is authenticated or not
<asp:LoginView>: It provides various login views depending on the selected template
<asp:PasswordRecovery>: E-mail users the lost password
10) Why code-behind feature is used in ASP.Net?
Code behind feature is used to make the code easy to understand by separating application logic from HTML tags. It also removes the browser incompatibility by provision of code files on web servers and support web pages to be compiled on demand.
11) What are main built-in objects in ASP.Net?
Following are some built-in objects in ASP.Net
12) What is virtual folder?
It contains web applications and has been published as virtual folder by IIS
13) What are methods of navigation in ASP.Net.
Following are methods for navigation in ASP.Net.
- Hyperlink control
- Window.Open script
14) What is AdRotator control in ASP.Net?
The AdRotator control is used for the purpose of advertisements to web pages. It randomly displays advertisements one by one when the web page is refreshed. This control is associated with links as you click on the advertisement, it redirects to other pages.
15) What is web.config?
Configuration files of ASP.Net are XML files for application level settings. These are saved in the name of web.config. These are available in multiple directories of web application server. ASP.Net uses the web.config files to compute collection of settings for every URL target request, at run time. These settings computer once and cached across further requests.
16) What is GAC?
GAC is Global Assembly Cache used to share .Net assemblies in case multiple application want to use same assembly.
17) What is CompareValidator control?
The CompareValidator control can compare the values of two controls.
18) Which property is used to access user’s locale information?
The System.Web.UI.Page.Culture property is used to access information regarding a user’s locale.
19) What is RequiredFieldValidator in ASP.Net?
RequiredFieldValidator when used, it makes the associated input control as required field.
20) What is RegularExpressionValidator?
It is another useful validator which is used to check the validity of all types of strings entered in input field.
21) What is globalization and localization?
The globalization is a procedure used to identify the specific part of a web application, different for various languages and make that part separate from the core of web application while localization is a technique to configure web application to make it supportive for a specific language or locale.
22) What is @Register directive in ASP.Net?
Register directive is used to register a custom server control to a web page.
23) What are Response.Write() and Response.Output.Write()?
The Response.Write() method allows you to write the normal output while the Response.Output.Write() method allows to write the formatted output.
24) What is IIS?
IIS stands for Internet Information Services. Microsoft has developed IIS to provide Internet-based services to ASP.Net web applications.
25) Which method is used to sign-out from forms authentication?
The FormsAuthentication.Signout() method is used to sign out from the forms authentication.
26) What is multilingual website?
A multilingual website contains content in many languages. It contains date, time and other resources in various languages.
27) Why ViewStateMode property is used in ASP.Net?
The ViewStateMode was created for the Control class. It is used to enable the view state to an individual control even if view state ASP.Net page is disabled.
28) What is the function of ValidationSummary control?
It is used to display all validation messages in one control.
29) What is the difference between authorization and authentication?
Authorization is a mechanism to grant access to an authenticated user of particular resources. Authentication verifies the identity of user. It is mechanism to get some credentials from users and verify user’s identity. The authentication takes before authorization.
30) What are cookies in ASP.Net?
Cookies are small and executable program and store the identity of user on its visit of website and validate its authenticity on next visit. These small files can be accessed by the web server or the client computer. These allows the server to deliver a page tailored to a particular user, or the page itself can contain some script which is aware of the data in the cookie.
31) What is state management?
State management is used to trace information or data that affect the state of applications. In .Net framework, state can be maintained by the following mechanism
- Client based state management uses the following techniques for implementation
- View State
- Hidden Fields
- Query Strings
- Control State
- Server-based state management uses following techniques for implementation
- Session State
- Profile Properties
- Application state