ASP.NET Interview Questions

ASP.Net is a web framework presented by Microsoft Corporations for developing web applications. It is a cross-platform which can run on any operating system such as Windows, Linux, Docker, macOS etc.

In this article, you can go through the set of ASP.NET interview questions most frequently asked in the interview panel. This will help you crack the interview as the topmost industry experts curate these at HKR training.

Let us have a quick review of the ASP.NET interview questions.

Most Frequently Asked ASP.NET Interview Questions

1. Mention few ASP.NET validators.

Ans: These are the most widely used validators in ASP.NET.

  • Required Field Validator.
  • Range Validator.
  • Compare Validator.
  • Summary Validator.
  • Regular Expression Validator.
  • Custom Validator.

2. List the events in the page life cycle.

Ans: The page life cycle events are as follows.

  • Page_PreInit
  • Page_Init
  • Page_InitComplete
  • Page_PreLoad
  • Page_Load
  • Page_LoadComplete
  • Page_PreRender
  • Render

3. What is the ASP.NET MVC framework?

Ans: ASP.NET MVC is a web application framework for the .NET Platform used for building full-stack web applications using the Model-View-Controller pattern.

4. What is an ASP.NET Web API framework?

Ans: ASP.NET Web API is used for building the backend web APIs which can be used by an array of clients, from the web to desktop to mobile. It forms the server component in the RESTful (Representational State Transfer) architecture.

5. Is it possible to create a web application with both webforms and MVC?

Ans: Yes. It is possible to create a web application with both webforms and MVC. The MVC assembly references have to be included in the web form applications for creating a hybrid application.




6. Which would be the right framework to be used ASP.NET MVC or ASP.NET Web API?

Ans: If there is a requirement for building a server component that can be easily utilized by an array of clients then ASP.NET Web API is the right approach to use it. If the project is purely going to be used as a web application, then ASP.NET MVC is a more appropriate choice to use.

7. What are the different types of cookies in ASP.NET?

Ans: There are two types of cookies available in ASP.NET.

  • Session Cookie: It resides on the client machine for a single session until the user does not log out.
  • Persistent Cookie: It resides on a user's machine for a specific period of expiry, such as 10 days, one month, and never.

8. What are the types of Authentication in ASP.NET?

Ans: There are three types of authentication available in ASP.NET.

  1. Windows Authentication: This method uses built-in windows security features to authenticate a user.
  2. Forms Authentication: The form authenticates against a customized list of users or users in a database.
  3. Passport Authentication: It validates against Microsoft Passport service which is basically a centralized authentication service.

9. What is role-based security?

Ans: It is used to implement security based on the roles assigned to user groups in the organization. Then you could allow or deny users based on their role in the organization. Windows defines several built-in groups, including Administrators, Users, and Guests.

< authorization >

< allow roles="Domain_Name\Administrators" / >   < !-- Allow Administrators in domain. -- >

< deny users="*"  / >                            < !-- Deny anyone else. -- >

< /authorization >

10. What are the components of ADO.NET?

Ans: The components of ADO.NET are as follows.

  • Dataset.
  • Data Reader. 
  • Data Adaptor. 
  • Command. 
  • Connection.

Asp.Net Online Certification Training

  • Master Your Craft
  • Lifetime LMS & Faculty Access
  • 24/7 online expert support
  • Real-world & Project Based Learning


11. How do you register JavaScript for web controls?

Ans: You can register JavaScript for web controls by using 

 Attribtues.Add(scriptname,scripttext) method.

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

Ans: By using “HtmlInputCheckBoxcontrol”, multiple items can be selected whereas, with “HtmlInputRadioButton” controls, only a single item is selected from the group of items.

13. What are the Advantages of Using ASP.NET Web API?

Ans: ASP.NET Web API has several advantages. The core advantages are.

  • It works with HTTP standard verbs such as GET, POST, PUT, DELETE, etc. for all CRUD operations.
  • It provides complete support for routing.
  • MediaTypeFormatter is used to generate the response in JSON or XML format.
  • It has the ability to host in IIS as well as self-host outside of IIS.
  • Model binding and Validation are supported.
  • OData is also supported.

14. What are the subtypes of ActionResult?

Ans: ActionResult is used for representing the action method result. The subtypes of ActionResult are as follows.

  • ViewResult.
  • PartialViewResult.
  • RedirectToRouteResult.
  • RedirectResult.
  • JavascriptResult.
  • JSONResult.
  • FileResult.
  • HTTPStatusCodeResult.

15. How can we prevent browsers from caching an ASPX page?

Ans: You can SetNoStore on HttpCachePolicy object which is displayed by the Response object's Cache property to prevent the browser from caching an ASPX page.


Response.Write(DateTime.Now.ToLongTimeString ());

16. What are the different Session state management options available in ASP.NET?

Ans: There are two-session state management options available in ASP.NET. The options are In-Process and Out-of-Process.

  1. The In-Process option stores the session in memory on the web server.
  2. The Out-of-Process Session state management stores data in an external server. All objects stored in session are required to be serializable.

17. Give some examples of web controls.


  • Button
  • Calendar
  • Checkboxlist
  • DropDownList
  • RadioButtonList

Subscribe to our youtube channel to get new updates..!


18. What is the difference between session and application object?

Ans: The difference between session and application object is as follows. 

Application object:

  1. One application object is shared by all users.
  2. Data stored in the application object can be shared by all the sessions of the application. The application object stores data in the key-value pair.

Session object:

  1. There is one session object for each user. 
  2. Session object store session-specific information and the information are visible within the session only. 
  3. ASP.NET creates a unique SessionId for each session of an application. SessionIDs are maintained either by an HTTP cookie or a modified URL with application configuration settings. By default, SessionID values are stored in cookies.

19. What is Razor in ASP.NET?


  • It is based on ASP.NET and is designed for creating web applications. 
  • It is a markup syntax that lets you embed the server-based code into web pages. 
  • The server-based code can create dynamic web content, while a web page is written to the browser. 
  • When a web page is called, the server executes the server-based code inside the page before it returns the page to the browser. 
  • The Razor code performs complex tasks by running the server by accessing databases. 
  • It has the power of traditional ASP.NET markup, but Razor is very easy to use and learn.

20. What is the difference between the web config and machine config?


Web  config:

  • This file is specific to a web application.
  • There can be multiple web config files into an application.

Machine config:

  • This file is specific to a machine or server.
  • There can be only one machine config file on a server.

21. What is the REST architecture?

Ans: REST (Representational State Transfer) is an architectural style to design applications and it explains the way to use HTTP for making the communication calls instead of complex mechanisms like CORBA, RPC or SOAP. There are few principles associated with REST architectural style:

  • Everything is a resource such as File, Images, Video, WebPage etc.
  • Unique Identifier identifies every resource.
  • Very simple and uniform interfaces must be used.
  • Everything is done with representations.
    Example: Sending requests from a client to server and receiving responses from server to client.
  • Be Stateless: Every request should be an independent request.

22. Explain the ASP.NET page life cycle in brief.

Ans: The page life cycle in ASP.NET goes with a series of stages on each page.

  1. Page request: The user requests a page. ASP.NET decides whether to compile it or serve it from a cache.
  2. Page Start: The Request and Response objects are created in this phase.
  3. Page Initialization: All page controls are initialized, and design themes are applied in this phase.
  4. Page Load: In this load phase, ASP.NET uses the view state and control state properties to set control properties. Default values are set in the controls.
  5. Postback event handling: This event is triggered if the same page is loaded again.
  6. Rendering: ASP.NET saves the view state for the page and writes the output of rendering to the output stream. It occurs just before sending the complete web page to the user.
  7. Unload: The rendered page gets sent to the client. ASP.NET unloads page properties and performs cleanup. All unwanted objects are removed from memory.

23. What is the difference between file-based dependency and key-based dependency?

Ans:File-based dependency: It facilitates you to save the dependency on a file in a disk.

       Key-based dependency: In this dependency, you have to depend on another cached item.

24. What is the difference between the GET method () and the POST method ()?


get method():

  • Data is appended to the URL.
  • Data is not secured in using the get method.
  • The transmission of data is fast.
  • It is a single call system.
  • Limited amount of data can be sent.
  • It is a default method for many browsers.

post method(): 

  • Data is not appended to the URL.
  • Data is secured in using the post method.
  • The transmission of data is slow compared to the get method.
  • It is a two call system.
  • A large amount of data can be sent.
  • It is not a default method, this method should be specified explicitly.

25. What is caching? What are the main requirements for caching?

Ans: Catching is a technique which allows storing the frequently used items in memory such that it can be accessed quickly. The catching main requirements are.

  • By caching the response, the request is served by the response which is already stored in memory.
  • The items must be chosen carefully to cache because Caching incurs overhead.
  • A frequently used web form which data doesn't frequently change is good for caching.
  • A cached web form freezes form’s server-side content and changes to that content do not appear until the cache is refreshed.

26. What is the usage of IIS?

Ans: The following are the main uses of IIS.

  • It is used to make your computer to work as a Web server and provides the functionality to develop and deploy Web applications on the server.
  • It handles the request and response cycle on the Web server.
  • IIS also offers the services of SMTP and FrontPage server extensions.
  • The SMTP is used to send emails and use FrontPage server extensions to get the dynamic features of IIS, such as form handler.

Asp.Net Online Certification Training

Weekday / Weekend Batches


27. What is the difference between server-side scripting and client-side scripting?


Server-side scripting: In server-side scripting, all the scripts are executed by the server and interpreted as needed.

Client-side scripting: In client-side scripting, the script will be executed immediately in the browser such as form field validation, email validation, etc.

The client-side scripting is usually carried out in VBScript or JavaScript.

28. What are the HTML server controls in ASP.NET?


  • HTML server controls are similar to HTML elements which are used on the HTML pages.
  • The HTML server controls are used for displaying the properties and events for use.
  • To make these controls programmatically accessible, you must specify that the HTML controls should act as a server control by adding the runat="server" attribute.

29. What is ASP.NET AJAX?

Ans: AJAX stands for Asynchronous JavaScript and XML. Microsoft provides an implementation of AJAX functionality known as ASP.NET AJAX. It is a cross-platform technology that speeds up response time and reduces traffic between client and server. It is a set of extensions which are appended to ASP.NET and comes with reusable AJAX controls.

30. What does the method Finalize do in ASP.NET?

Ans: The Finalize method performs the cleanup operations on unmanaged resources that is held by an object. This method keeps an object in the finalization queue. The Object will then be collected by the garbage collector ready to be cleaned up.

Find our upcoming Asp.Net Online Certification Training Online Classes

  • Batch starts on 28th Sep 2023, Weekday batch

  • Batch starts on 2nd Oct 2023, Weekday batch

  • Batch starts on 6th Oct 2023, Fast Track batch

Global Promotional Image


Request for more information

Kavya Gowda
Kavya Gowda
Research Analyst
Kavya works for HKR Trainings institute as a technical writer with diverse experience in many kinds of technology-related content development. She holds a graduate education in the Computer science and Engineering stream. She has cultivated strong technical skills from reading tech blogs and also doing a lot of research related to content. She manages to write great content in many fields like Programming & Frameworks, Enterprise Integration, Web Development, SAP, and Business Process Management (BPM). Connect her on LinkedIn and Twitter.