A list of top frequently asked ASP.NET interview questions and answers are given below.
1) What is ASP?
ASP stands for Active Server Pages. It is also known as classic ASP. It is a server side technology provided by Microsoft which is used to create dynamic and user-friendly web pages. It uses different scripting languages to create dynamic web pages which can be run on any type of browsers.
2) What is ASP.NET?
ASP.Net is a specification by Microsoft which is used to create web applications and web services. It is a part of .Net framework. You can create ASP.Net applications in most of the .Net compatible languages like Visual Basic, C# etc. ASP.Net provides much better performance than scripting languages.
3) What is the difference between the ASP and ASP.NET?
The main difference between ASP and ASP.Net is that ASP is interpreted, while ASP.Net is compiled. ASP uses VBScript, therefore when the ASP page is executed, it is interpreted. On the other hand, ASP.Net uses .Net languages like C# and VB.NET, which is compiled to Microsoft intermediate language.
4) What are the advantages of ASP.NET?
ASP.Net is the next generation of ASP technology platform. It is superior to ASP in the following ways:
- Highly Scalable
- Compiled Code
- User Authentication
- Language Support
- Third party control
- Configuration and Deployment is easy.
- Object and Page caching
- Strict coding requirements
5) What is the concept of Postback in ASP.NET?
Postback is a request which is sent from a client to the server from the same page user is working with. There is HTTP POST request mechanism in ASP.NET. It basically posts a complete page back to server to refresh the whole page.
6) How to check that the page is Post Back?
The “isPostBack” property of page object is used to check that the page is posted back or not.
7) What is the parent class of all web server control?
8) What is the difference between ASP.NET Webforms and ASP.NET MVC?
ASP.NET Webforms uses the page controller approach for rendering layout. In this approach, every page has its own controller.
On the other hand, ASP.NET MVC uses Front Controller approach. In this approach, there is a common controller for all pages.
9) What is the difference between GET method () and POST method ()?
|No.||get method( )||post method( )|
|1.||Data is affixed to the url.||Data is not affixed to the url.|
|2.||Data is not secured.||Data is secured.|
|3.||Data transmission is faster in this method.||Data transmission is comparatively slow.|
|4.||This is a single call system.||This is a two call system.|
|5.||Only limited amount of data can be sent.||Large amount of data can be sent.|
|6.||It is a default method for many browsers.||It is not set as default. it should be explicitly specified.|
10) What is the difference between session object and application object??
The session object is used to maintain the session of each user. A session id is generated if a user enters in the application and when the user leaves the application, the session id is automatically deleted.
On the other hand, application object is used to store the information and access variables from any page in the application.
11) How to sign out from forms authentication?
FormsAuthentication.Signout() method is used to sign out from forms authentication.
12) How to display validation messages in one control?
By the help of ValidationSummary control, we can display all validation messages in one control.
13) What is the difference between authentication and authorization?
Authentication is a process of identifying user whereas authorization is used to check the access rights of an identified user.
14) Which object encapsulates state or data of an user?
15) What is ViewState?
ViewState is a features of ASP.NET to store the values of a page before it is submitted to the server. After posting the page, data from is ViewState is restored.
16) What is ViewState information stored?
It is stored in HTML hidden field.
17) What are the differences between the Response.Write() and Response.Output.Write()?
Response.Write() is used for normal output whereas Response.Output.Write() is used for formatted output.
18) Define the types of configuration files.
There are two types of configuration files:
- Application Level config = Web.config.
- Machine Level config = Machine.config.
19) What is the difference between Web config and Machine config files?
Web config file is specific to web application whereas Machine config file is specific to machine or server.
There can be multiple web config files in an application but only one machine config file.
20) What is MVC?
MVC stands for Model View Controller. It is a design pattern that is used to separate business logic and presentation logic. It is used to develop highly customized application.
Model represents data, View represents presentation and controller acts as an interface between Model and View.
20) What are the built-in objects in ASP.NET?
The major built-in objects are given below:
21) What is Role-base security?
In role-based security, you can assign a role to each user. In such way, each user has privilege to do some task.
22) What is cookie?
Cookie is a small piece of information which is stored at client side. There are two types of cookie:
- Session/Temporary Cookie: valid for single session
- Persistent Cookie: valid for multiple session
23) What is the default timeout for cookie?
24) Which protocol is used to call web service?
25) What is the file extension of web service?
File extension of web service is .asmx.