ASP.NET Interview Questions and Answers (2026) – Beginner to Advanced
This article provides the latest ASP.NET interview questions and answers (2026) for beginners and experienced professionals. It covers core ASP.NET concepts such as the .NET framework, MVC, Web API, C#, authentication, and real-world scenarios to help you confidently prepare for interviews.
These ASP.NET interview questions are commonly asked in companies like TCS, Infosys, Accenture, Wipro, and product-based companies.
Basic :
1. How does the .NET framework work?
Answer : The .NET Framework works as a platform to build, run, and manage applications.
You write code in C#, VB, etc.
Code is compiled into IL (Intermediate Language)
IL is executed by CLR
CLR converts IL into machine code using JIT compiler
Program runs on the operating system
2. Explain about major components of the .NET framework.
Answer :
CLR (Common Language Runtime)
Executes code
FCL / BCL (Framework Class Library)
Predefined classes for file handling, database, collections, etc.
CTS (Common Type System)
Ensures type safety
CLS (Common Language Specification)
Ensures language interoperability
3. What is CLS?
Answer : CLS (Common Language Specification) is a set of rules that all .NET languages must follow.
Allows different .NET languages to work together
Ensures cross-language compatibility
4. What is JIT compiler ?
Answer : JIT (Just-In-Time) compiler converts IL code into machine code at runtime.
Faster execution
Platform independent
5. What is the difference between int and Int32?
Answer : int is alias of int32. Both are same
6. Explain the differences between value type and reference type.
Answer :
Value Type :
- Store in stack
- Faster
- Hold Actual data
Reference Type :
- Store in Heap
- Hold reference
- slower
7. Explain the role of the ConfigurationManager class in .NET configuration management.
Answer : The ConfigurationManager class is used to read configuration values from config files.
Read connection strings
Read app settings
8. What is the difference between an exe and a dll file in .NET?
Answer :
exe :
- Can run independently
- Standalone application
- Entry point
dll :
- Library
- Can not run alone
- No Main() method
9. What is the difference between string and StringBuilder in .NET?
Answer :
String :
- It is Immutable
- New object created on change
- Less memory efficient
StringBuilder :
- It is Mutable
- Same object modified
- More efficient
10. What is CLR?
Answer : CLR (Common Language Runtime) is the execution engine of .NET.
Memory management
Garbage collection
Security
Exception handling
11. What is web config?
Answer : web.config is a configuration file used in ASP.NET applications.
Connection strings
App settings
Error handling settings
12. Explain querystring
Answer : QueryString is a way to pass data through URL.
Example : site.com/page?id=10
13. What is MVC
Answer : MVC (Model-View-Controller) is an architectural pattern.
Model – Business logic & data
View – UI
Controller – Handles requests
14. What is routing
Answer :Routing maps a URL to a controller action.
15. MVC life cycle
Answer :
Request received
Routing
Controller initialization
Action method execution
Model binding
Response sent to browser
16. What will be first execute in MVC project
Answer : Routing executes first.
17. What is tempdata , view data and view bag
Answer :
TempData :
- Dictionary
- Next request
- Redirect support
- pass data from one controller to another controller
ViewData , ViewBag :
- Current request
- pass data from one controller to View
18. How to pass data from controller to view
Answer :
using below :
ViewBag
ViewData
Model
19. How to pass data from 1 controller to multiple controller
Answer : Using Keep Data
20. Explain the Difference Between Managed and Unmanaged Code In .NET
Answer :
Managed Code :
- Runs under CLR
- Garbage collected
- Secure
Unmanaged Code :
- Runs outside CLR
- Manual memory management
- Less secure
21. what is Garbage Collector ?
22. Why do we need a Garbage Collector?
Answer : When your program runs, it creates many objects in memory.
If this memory is not released properly, the application can:
Consume too much memory
Become slow
The Garbage Collector solves this problem automatically.
23 . How does Garbage Collector work in .NET?
Answer :
Objects are created in managed heap
GC tracks which objects are still in use
Objects that are not referenced anymore are marked as garbage
GC removes them and frees memory
24. Key responsibilities of Garbage Collector
Answer :
Automatic memory cleanup
Prevents memory leaks
Improves application performance
Works only for managed code
25. Generations in Garbage Collector ?
Answer :
- Gen 0 –> Short-lived objects
- Gen 1 –> Medium-lived objects
- Gen 2 –> Long-lived objects
Advanced :
1.What is the web.config file?
Answer : The web.config file is an XML-based configuration file used in ASP.NET applications. It stores application-level settings such as database connection strings, authentication modes, session state, error handling, and custom configuration values.
2. Which compiler is used in ASP.NET?
Answer : The code is compiled into Intermediate Language (IL) and then converted into native code by the JIT (Just-In-Time) compiler at runtime.
3. Explain the Global.asax file?
Answer : The Global.asax file (Application file) is used to handle application-level events such as:
Application_Start
Session_Start
Application_Error
It is mainly used for routing, error handling, and application initialization logic.
4. Explain the differences between GridView and DataGrid?
Answer :
GridView :
- Built-in Paging & Sorting
- Easy to Customization
- Better Performance
DataGrid :
- Manual Paging & Sorting
- Limited Customization
- Slower Performance
5. What are the different validation controls in ASP.NET?
Answer : ASP.NET provides built-in validation controls:
RequiredFieldValidator
RangeValidator
CompareValidator
RegularExpressionValidator
CustomValidator
6. What is Razor in ASP.NET?
Answer : Razor is a lightweight view engine used in ASP.NET MVC and ASP.NET Core. HTML using @ syntax, making views clean, readable, and easy to maintain.
7. What are the types of Authentication in ASP.NET?
Answer :
Windows Authentication
Forms Authentication
Token-based Authentication (JWT)
OAuth / OpenID Connect
8. What are the advantages of using the MVC pattern?
Answer :
Clear separation of concerns
Better testability
Full control over HTML
Easy maintenance
Clean URL structure
9. What are the main differences between ASP.NET Web Forms and ASP.NET MVC?
Answer :
Web Forms :
- Event-driven Architecture
- View State is use
- complex URL Structure
MVC :
- Pattern-based Architecture
- No View state use
- SEO-friendly URL Structure
10. What is the role of the ViewModel in MVC?
Answer : A ViewModel is a class specifically designed to pass data from the Controller to the View.
11. Can you explain the concept of routing in MVC and its benefits?
Answer : Routing maps incoming URLs to controllers and actions.
12. What are the types of pages in ASP.NET?
Answer :
Web Forms (.aspx)
Razor Pages (.cshtml)
MVC Views
13. What is the role of the HTTP request-response cycle in ASP.NET?
Answer :
Client sends a request
Server processes it
ASP.NET executes code
Response is returned to the client
14. What are the main types of HTTP request methods in ASP.NET?
Answer :
GET – Retrieve data
POST – Send data
PUT – Update data
DELETE – Remove data
PATCH – Partial update
15. What is View State in ASP.NET and how does it work?
Answer : View State stores page-level data across postbacks.
It is stored as a hidden field in the page and encoded using Base64.
16. What is a Master Page in ASP.NET?
Answer : A Master Page defines a common layout (header, footer, navigation)
17. What is a User Control in ASP.NET?
Answer : A User Control (.ascx) is a reusable UI component used across multiple pages, such as headers, menus, or custom widgets.
18. What is a Data Set in ASP.NET?
Answer : A DataSet is an in-memory, disconnected data container that can hold multiple tables, relationships, and constraints.
19. What is the difference between Data Set and Data Reader in ASP.NET?
Answer :
DataSet :
- Slower Performance
- Read/Write
- High Memory usage
DataReader :
- Faster Performance
- Read-only
- Low Memory usage
20. What is the difference between Authentication and Authorization in ASP.NET?
Answer :
Authentication :
- Verifies who the user is
- It is use for login
- It is use for identity of user
Authorization :
- It is use for which user have which role access
- It is use for Permission check