Quick answer
Most ASP.NET interviews now focus on ASP.NET Core, Microsoft’s cross-platform, open-source framework for web apps and APIs: middleware, dependency injection, routing, model binding, authentication and Entity Framework Core. Classic ASP.NET topics, such as Web Forms, postbacks, ViewState and web.config, still come up for teams maintaining older applications.
ASP.NET interviews have changed a lot. Most new projects, and most interview questions, are now about ASP.NET Core, the cross-platform, open-source rewrite. But many companies still run older ASP.NET applications built on Web Forms and the .NET Framework, so interviewers often ask about both. This guide covers the questions asked most often, and makes clear where an answer applies to classic ASP.NET and where it applies to ASP.NET Core.
ASP.NET Interview Questions and Answers for Freshers

1. What is classic ASP?
ASP, Active Server Pages, was Microsoft’s first server-side scripting technology, released in 1996. Pages mixed HTML with script, usually VBScript, that ran on the server under IIS. It is now called classic ASP to distinguish it from ASP.NET, which replaced it, and it is only found in old applications.
2. What is ASP.NET?
ASP.NET is Microsoft’s framework for building websites, web applications and web APIs with .NET, usually in C#. It was released in 2002 with the .NET Framework. Unlike classic ASP, its code is compiled, and it has a full class library, a type system, and tools behind it.
3. What is the difference between ASP.NET and ASP.NET Core?
- ASP.NET (often called ASP.NET Framework) runs on the .NET Framework, only on Windows, and is usually hosted in IIS. It includes Web Forms, MVC 5 and Web API 2. It still receives security fixes, but no new features.
- ASP.NET Core, released in 2016, is a redesigned, open-source framework that runs on modern .NET on Windows, Linux and macOS, in containers and in the cloud. It is faster, modular, and has dependency injection built in. It does not support Web Forms.
Since 2020, the cross-platform runtime has simply been called .NET, with a new major version every November. Even-numbered versions get long-term support. New projects should use ASP.NET Core on a currently supported .NET version.
4. Is ASP.NET open source?
ASP.NET Core and modern .NET are fully open source, under the MIT and Apache 2.0 licenses, and developed in public on GitHub, which is why they run on Windows, Linux and macOS. ASP.NET MVC, Web API and Razor were also open-sourced in 2012. The older .NET Framework itself is not open source in the same way: Microsoft publishes its source for reference, but it is a Windows component and is not developed in the open.
5. What is IIS, and what is Kestrel?
IIS, Internet Information Services, is Microsoft’s web server for Windows, and it is the standard host for classic ASP.NET applications. Kestrel is the cross-platform web server built into ASP.NET Core. Every ASP.NET Core app runs on Kestrel, or inside IIS with in-process hosting. In production, Kestrel is often placed behind a reverse proxy such as IIS, Nginx, or a cloud load balancer, which handles concerns such as TLS certificates.
6. What is the difference between server-side and client-side scripting?
Server-side code, such as C# in ASP.NET, runs on the web server: it can access databases and secrets, and sends the finished HTML or JSON to the browser. Client-side code, JavaScript, runs in the user’s browser after the page arrives: it makes the page interactive, but users can see and change it. That is why validation and security checks must always happen on the server, even when they are also done in the browser.
7. What is MVC?
Model-View-Controller is a design pattern that separates an application into three parts. The model holds the data and business logic, the view displays it, and the controller handles requests, works with the model, and chooses a view. The separation makes code easier to test and change. ASP.NET MVC applies this pattern to web applications, and ASP.NET Core supports it as MVC with controllers and Razor views.
8. What is Web API, and how is it different from MVC?
Web API is for building HTTP services that return data, usually JSON, to clients such as JavaScript front ends, mobile apps or other services, rather than HTML pages. In classic ASP.NET, MVC and Web API were separate frameworks. In ASP.NET Core they were merged: the same controllers can return views or data, and API controllers are simply marked with [ApiController]. So the choice is now about what you return. Use views for server-rendered pages, and API endpoints when other clients consume your data.
9. What are Minimal APIs?
Minimal APIs, introduced in .NET 6, let you define HTTP endpoints directly in Program.cs with very little code, without controller classes. They suit small services and microservices.
var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();
app.MapGet("/products/{id}", (int id) => Results.Ok(new { id, name = "Laptop" }));
app.Run();
10. What are Razor Pages and Blazor?
Razor Pages is a page-based model in ASP.NET Core, where each page has its markup and a code-behind class together. It is simpler than MVC for page-focused apps, and is often seen as the modern successor to Web Forms. Blazor builds interactive web UIs in C# instead of JavaScript, with components that run on the server or in the browser through WebAssembly.
11. What is a postback?
A postback is a Web Forms concept: when a user clicks a button, the page submits back to itself on the server, which runs the event handler and sends the updated page back. Web Forms uses ViewState, a hidden field holding the controls’ state, so controls appear to remember their values between postbacks. Page.IsPostBack tells you whether the page is loading for the first time. ASP.NET Core has no postbacks or ViewState.
12. What is web.config, and what replaced it in ASP.NET Core?
In classic ASP.NET, web.config is an XML file holding the application’s settings, such as connection strings, authentication and error pages, so they can change without recompiling. Sections can be encrypted. ASP.NET Core uses appsettings.json instead, with environment-specific files such as appsettings.Production.json, and also reads environment variables and command-line arguments. Secrets should come from user secrets in development and a vault such as Azure Key Vault in production, never from source control. A web.config may still exist in an ASP.NET Core app, but only to configure IIS hosting.
13. What is caching, and why does it matter?
Caching keeps a copy of data or output that is expensive to produce, such as a database result or a rendered page, so later requests can be served from memory instead of being produced again. It reduces response times and the load on databases and servers, which is what lets an application handle more traffic.
14. What types of caching does ASP.NET support?
In classic ASP.NET:
- Output caching: stores a whole rendered page.
- Fragment caching: stores part of a page, such as a user control.
- Data caching: stores objects in the
Cacheobject.
In ASP.NET Core:
- In-memory caching with
IMemoryCache, on a single server. - Distributed caching with
IDistributedCache, backed by Redis or SQL Server, shared across servers. - Response caching, which uses HTTP cache headers, and output caching middleware, added in .NET 7, which stores responses on the server.
- HybridCache, added in .NET 9, which combines in-memory and distributed caching and protects against many requests rebuilding the same entry at once.
15. What is a multilingual website, and how does ASP.NET support it?
A multilingual website presents its content in several languages, and adapts formats such as dates, numbers and currency to each culture. This is called globalization and localization. ASP.NET Core provides localization middleware to choose the culture for each request, and resource files that hold the translated text, which are read through IStringLocalizer.
16. What is a cookie, and what types are there?
A cookie is a small piece of data the server asks the browser to store and send back with later requests. A session cookie has no expiry date and is deleted when the browser closes. A persistent cookie has an expiry date and survives until then. Cookies holding anything sensitive should be marked HttpOnly, so JavaScript cannot read them, Secure, so they are only sent over HTTPS, and given a SameSite setting to help against CSRF.
17. What is the default timeout for a cookie or session?
It depends which one is meant, which is worth pointing out in an interview. A cookie with no expiry lasts until the browser closes. In classic ASP.NET, session state times out after 20 minutes of inactivity by default, and the Forms Authentication cookie after 30 minutes. In ASP.NET Core, the authentication cookie’s default lifetime is 14 days, and session state’s idle timeout is 20 minutes. All of these can be configured.
ASP.NET Interview Questions for Experienced Developers

18. What is middleware in ASP.NET Core?
Middleware are components that form the request pipeline. Each one receives the HTTP request, can do work before and after calling the next component, and can end the request early. Built-in middleware handles routing, authentication, authorization, static files, CORS, error handling and more. Order matters: for example, authentication must run before authorization.
app.UseExceptionHandler("/error");
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
app.MapControllers();
19. How does dependency injection work in ASP.NET Core?
Dependency injection is built in. You register services in Program.cs, and the framework creates them and passes them to the classes that need them, usually through the constructor. Each registration has a lifetime:
- Transient: a new instance every time one is requested.
- Scoped: one instance per HTTP request. The usual choice for database contexts.
- Singleton: one instance for the whole application.
builder.Services.AddScoped<IOrderService, OrderService>();
public class OrdersController : ControllerBase
{
private readonly IOrderService _orders;
public OrdersController(IOrderService orders) => _orders = orders;
}
A common mistake is injecting a scoped service, such as a database context, into a singleton, which keeps it alive far longer than intended.
20. What is the options pattern?
The options pattern binds a section of configuration to a strongly typed class, so code reads settings through properties instead of string keys. You register it with builder.Services.Configure<SmtpOptions>(builder.Configuration.GetSection("Smtp")) and inject IOptions<SmtpOptions> where you need it. IOptionsMonitor also picks up changes to the configuration while the app is running.
21. What is routing?
Routing maps incoming URLs to the code that handles them. Attribute routing puts routes on controllers and actions, such as [HttpGet("api/orders/{id}")], and is the norm for APIs. Conventional routing uses a pattern such as {controller}/{action}/{id?}, common in MVC apps. Route constraints, such as {id:int}, restrict what a segment can match.
22. What is model binding?
Model binding automatically converts data from the request, such as route values, query strings, form fields, headers and JSON bodies, into the parameters of an action method. Attributes such as [FromBody], [FromQuery] and [FromRoute] say where a value comes from. With [ApiController], complex types are read from the body by default.
23. How does validation work?
In ASP.NET Core, you usually add data annotation attributes to your models, such as [Required], [StringLength], [Range] and [EmailAddress]. After model binding, the results are in ModelState. With [ApiController], an invalid model returns a 400 response with the errors automatically. MVC views also generate matching client-side validation, but server-side validation always runs, because client-side checks can be bypassed.
In Web Forms, validation used validation controls: RequiredFieldValidator, CompareValidator, RangeValidator, RegularExpressionValidator and CustomValidator, with ValidationSummary displaying all the errors together.
24. What are filters?
Filters run code at particular points around a controller action, for concerns that apply to many actions. The types, in the order they run, are: authorization filters, resource filters, action filters (before and after the action), exception filters, and result filters (around the response). Typical uses are logging, validation, caching and consistent error responses. Filters only run for MVC and API controllers, while middleware runs for every request.
25. What are the authentication options?
In classic ASP.NET there were three modes: Windows authentication, using the user’s Windows account, Forms authentication, a login form checked against your own user store, and Passport, which used Microsoft’s Passport service and has long been discontinued.
In ASP.NET Core the common options are:
- Cookie authentication: for server-rendered web apps.
- JWT bearer tokens: for APIs called by single-page or mobile apps.
- OpenID Connect and OAuth 2.0: signing in through an identity provider such as Microsoft Entra ID, Google or Auth0.
- ASP.NET Core Identity: a built-in membership system for user accounts, password hashing, two-factor authentication and external logins.
- Windows authentication: still available for intranet apps.
26. What is the difference between authentication and authorization?
Authentication establishes who the user is. Authorization decides what they are allowed to do. In ASP.NET Core, [Authorize] requires a signed-in user, and can require a role, such as [Authorize(Roles = "Admin")], or a named policy built from claims, such as requiring a particular subscription level.
27. What is the difference between Redirect and RedirectPermanent?
Redirect sends an HTTP 302 response, a temporary redirect, so search engines keep the original URL. RedirectPermanent sends a 301 response, telling browsers and search engines the page has moved for good, so they update their links and pass ranking to the new URL. ASP.NET Core also has versions that preserve the request method, which send 307 and 308.
28. What is Entity Framework Core?
EF Core is .NET’s object-relational mapper. You define C# classes for your data and a DbContext, and query with LINQ, which EF Core translates into SQL. Migrations generate and apply database schema changes from your model. For performance, watch for N+1 queries, use AsNoTracking() for read-only queries, and select only the columns you need.
29. Why use async and await in ASP.NET Core?
When a request waits on I/O, such as a database query or an HTTP call, an async method releases its thread back to the pool while it waits, rather than blocking. That lets the server handle many more requests at once with the same threads. Use async all the way through, and avoid blocking on async code with .Result or .Wait(), which can cause thread starvation and deadlocks.
30. What is CORS?
Browsers block JavaScript on one origin from calling an API on another origin unless the API allows it. Cross-Origin Resource Sharing (CORS) is how the API declares which origins, methods and headers are allowed. In ASP.NET Core you define a policy with the specific front-end origins, and apply it with app.UseCors(). Avoid allowing every origin on an API that uses cookies or other credentials.
31. What is the difference between a page theme and a global theme?
This is a Web Forms question. Themes define the look of server controls with skin files and stylesheets. A page theme belongs to one application and lives in a subfolder of its App_Themes folder. A global theme is installed on the web server and is available to every application on that server. ASP.NET Core does not use themes. Styling is done with ordinary CSS.
32. How do you handle errors globally?
In ASP.NET Core, use the exception handler middleware, app.UseExceptionHandler(), or implement IExceptionHandler, added in .NET 8, to catch unhandled exceptions in one place, log them, and return a consistent error response. APIs should return a ProblemDetails response rather than a stack trace. The developer exception page should only be enabled in development.
33. How do you improve ASP.NET Core performance?
- Use async I/O throughout, and avoid blocking calls.
- Cache expensive data and responses.
- Optimize database access: efficient queries, indexes, and no N+1 queries.
- Enable response compression, and serve static files from a CDN.
- Use
IHttpClientFactoryrather than creating a newHttpClientfor every request. - Run on a current .NET version, since each release brings significant performance gains.
- Measure before optimizing, with logging, metrics, and tools such as dotnet-counters and Application Insights.

Conclusion
For a modern ASP.NET interview, focus on ASP.NET Core: middleware, dependency injection, routing and model binding, authentication, and EF Core. Know enough about Web Forms, ViewState and web.config to talk about older applications, because many teams are still maintaining or migrating them. If you were asked an ASP.NET question recently that is not here, share it in the comments and we can work through the answer together.
Sources and further reading
- ASP.NET Core documentation: Microsoft Learn’s official docs
- Entity Framework Core documentation: EF Core guides and reference
- .NET support policy: which .NET versions are supported, and for how long

Leave a Reply