ASP.NET Core Interview Questions and Answers

Practice every question in this topic using expandable answers and interview tips. Answer aloud first, then open the explanation.

Back to the complete interview hub

Read question Answer aloud Review
Q1. What is ASP.NET Core? [Easy]

Answer: ASP.NET Core is an open-source, cross-platform web development framework developed by Microsoft for building modern web applications, RESTful APIs, cloud-native services, and microservices. It runs on Windows, Linux, and macOS and is optimized for high performance and scalability.

Interview tip: Define it clearly, give a small example, and mention one practical use or limitation.

Q2. What are the main features of ASP.NET Core? [Easy]

Answer: ASP.NET Core provides cross-platform support, high performance, built-in dependency injection, middleware architecture, Razor Pages, MVC, Web API, Minimal APIs, configuration providers, logging, authentication, authorization, cloud readiness, Docker support, and seamless Azure integration.

Interview tip: Define it clearly, give a small example, and mention one practical use or limitation.

Q3. What is the difference between ASP.NET and ASP.NET Core? [Medium]

Answer: ASP.NET is the traditional Microsoft web framework that runs primarily on Windows and the .NET Framework. ASP.NET Core is a modern, cross-platform framework that runs on .NET, supports Windows, Linux, and macOS, offers better performance, built-in dependency injection, and is optimized for cloud and container-based applications.

Interview tip: Define it clearly, give a small example, and mention one practical use or limitation.

Q4. What is Kestrel in ASP.NET Core? [Medium]

Answer: Kestrel is the default cross-platform web server used by ASP.NET Core applications. It is lightweight, fast, and optimized for high-performance HTTP workloads. In production, it is often used behind reverse proxy servers such as IIS, Nginx, or Apache.

Interview tip: Define it clearly, give a small example, and mention one practical use or limitation.

Q5. What is the purpose of the Program.cs file in ASP.NET Core? [Medium]

Answer: Program.cs is the application's entry point. It creates the web application, configures services, registers middleware, defines routing, and starts the web server. In .NET 6 and later, Program.cs uses the simplified hosting model instead of separate Startup.cs and Program.cs files.

Interview tip: Define it clearly, give a small example, and mention one practical use or limitation.

Q6. What is the request processing pipeline in ASP.NET Core? [Medium]

Answer: The request processing pipeline is the sequence of middleware components that process incoming HTTP requests and outgoing responses. Each middleware can handle, modify, or pass the request to the next middleware in the pipeline.

Interview tip: Define it clearly, give a small example, and mention one practical use or limitation.

Q7. What is Middleware in ASP.NET Core? [Medium]

Answer: Middleware is software that handles HTTP requests and responses within the request pipeline. Middleware components perform tasks such as routing, authentication, authorization, exception handling, logging, static file serving, CORS, and response compression.

Interview tip: Define it clearly, give a small example, and mention one practical use or limitation.

Q8. What are the advantages of ASP.NET Core? [Easy]

Answer: ASP.NET Core offers excellent performance, cross-platform compatibility, built-in dependency injection, modular architecture, cloud readiness, container support, side-by-side versioning, security features, and support for modern web development patterns.

Interview tip: Define it clearly, give a small example, and mention one practical use or limitation.

Q9. What project types can be developed using ASP.NET Core? [Medium]

Answer: ASP.NET Core can be used to build MVC web applications, Razor Pages applications, RESTful Web APIs, Minimal APIs, SignalR applications, gRPC services, microservices, cloud-native applications, and Blazor-hosted solutions.

Interview tip: Define it clearly, give a small example, and mention one practical use or limitation.

Q10. Why is ASP.NET Core preferred for modern enterprise applications? [Hard]

Answer: ASP.NET Core is preferred because it delivers high performance, cross-platform support, built-in dependency injection, excellent security, cloud-native architecture, Docker and Kubernetes support, scalable hosting, modern API development capabilities, and seamless integration with Azure and other cloud platforms. Its modular design also simplifies testing and maintenance.

Interview tip: Define it clearly, give a small example, and mention one practical use or limitation.

Q11. What is Routing in ASP.NET Core? [Medium]

Answer: Routing is the process of mapping incoming HTTP requests to controller actions, Razor Pages, Minimal APIs, or endpoints. It enables applications to respond to URLs by directing requests to the appropriate code.

Interview tip: Define it clearly, give a small example, and mention one practical use or limitation.

Q12. What is Endpoint Routing? [Medium]

Answer: Endpoint Routing is the routing system introduced in ASP.NET Core that matches incoming requests to endpoints during middleware execution. It provides a unified routing model for MVC, Razor Pages, SignalR, gRPC, and Minimal APIs.

Interview tip: Define it clearly, give a small example, and mention one practical use or limitation.

Q13. Why is middleware ordering important in ASP.NET Core? [Hard]

Answer: Middleware executes in the order it is registered. Incorrect ordering can prevent authentication, authorization, routing, exception handling, or static file serving from working correctly. Proper middleware order ensures requests flow through the pipeline as intended.

Interview tip: Define it clearly, give a small example, and mention one practical use or limitation.

Q14. What is appsettings.json? [Medium]

Answer: appsettings.json is the primary configuration file used in ASP.NET Core. It stores application settings such as database connection strings, logging configuration, API keys, feature flags, and custom application settings in JSON format.

Interview tip: Define it clearly, give a small example, and mention one practical use or limitation.

Q15. What are environment variables in ASP.NET Core? [Medium]

Answer: Environment variables allow configuration values to be supplied outside the application code. They are commonly used to store sensitive information, environment-specific settings, and deployment configuration without modifying application files.

Interview tip: Define it clearly, give a small example, and mention one practical use or limitation.

Q16. What are Configuration Providers in ASP.NET Core? [Medium]

Answer: Configuration Providers load configuration data from multiple sources such as appsettings.json, appsettings.{Environment}.json, environment variables, command-line arguments, user secrets, Azure Key Vault, and custom providers.

Interview tip: Define it clearly, give a small example, and mention one practical use or limitation.

Q17. What is Dependency Injection (DI) in ASP.NET Core? [Easy]

Answer: Dependency Injection is a design pattern that provides required services to a class instead of creating them inside the class. ASP.NET Core has built-in support for dependency injection, improving modularity, testability, and maintainability.

Interview tip: Define it clearly, give a small example, and mention one practical use or limitation.

Q18. How are services registered in ASP.NET Core? [Medium]

Answer: Services are registered in the dependency injection container using methods such as AddSingleton(), AddScoped(), and AddTransient(). These registrations are typically performed in Program.cs during application startup.

Interview tip: Define it clearly, give a small example, and mention one practical use or limitation.

Q19. What are the service lifetimes in ASP.NET Core? [Hard]

Answer: ASP.NET Core supports three service lifetimes: Singleton creates one instance for the application's lifetime, Scoped creates one instance per HTTP request, and Transient creates a new instance every time the service is requested.

Interview tip: Define it clearly, give a small example, and mention one practical use or limitation.

Q20. What is the Options Pattern in ASP.NET Core? [Hard]

Answer: The Options Pattern provides a strongly typed way to access configuration values. Configuration sections from files such as appsettings.json are bound to C# classes, making configuration easier to manage, validate, and test.

Interview tip: Define it clearly, give a small example, and mention one practical use or limitation.

Q21. What is the MVC architecture in ASP.NET Core? [Medium]

Answer: MVC (Model-View-Controller) is a design pattern that separates an application into three components. The Model manages application data and business logic, the View displays the user interface, and the Controller handles HTTP requests, processes user input, and coordinates communication between the Model and View.

Interview tip: Define it clearly, give a small example, and mention one practical use or limitation.

Q22. What are Razor Pages in ASP.NET Core? [Medium]

Answer: Razor Pages is a page-based programming model for building web applications. Each page contains a Razor (.cshtml) file and an associated PageModel class, making it easier to develop applications that are centered around individual pages rather than controllers.

Interview tip: Define it clearly, give a small example, and mention one practical use or limitation.

Q23. What is a Controller in ASP.NET Core MVC? [Easy]

Answer: A Controller is a class responsible for handling incoming HTTP requests, processing business logic, interacting with services or models, and returning responses such as Views, JSON data, files, or HTTP status codes.

Interview tip: Define it clearly, give a small example, and mention one practical use or limitation.

Q24. What is an Action Method? [Easy]

Answer: An Action Method is a public method inside a controller that responds to an HTTP request. It processes the request and returns an IActionResult or another supported response type such as a View, JSON object, redirect, or file.

Interview tip: Define it clearly, give a small example, and mention one practical use or limitation.

Q25. What is Model Binding in ASP.NET Core? [Medium]

Answer: Model Binding automatically maps data from HTTP requests, such as route values, query strings, form fields, and request bodies, to action method parameters or model objects. This reduces manual parsing and simplifies request processing.

Interview tip: Define it clearly, give a small example, and mention one practical use or limitation.

Q26. What is Model Validation? [Medium]

Answer: Model Validation verifies that incoming data satisfies validation rules before it is processed. ASP.NET Core commonly uses data annotation attributes such as Required, StringLength, Range, EmailAddress, and RegularExpression to validate model properties automatically.

Interview tip: Define it clearly, give a small example, and mention one practical use or limitation.

Q27. What are Filters in ASP.NET Core? [Hard]

Answer: Filters execute code before or after specific stages of request processing. They provide a clean way to implement cross-cutting concerns such as authorization, logging, exception handling, result modification, resource management, and action execution.

Interview tip: Define it clearly, give a small example, and mention one practical use or limitation.

Q28. What is an Action Filter? [Hard]

Answer: An Action Filter is a type of filter that executes code before and after an action method runs. It is commonly used for logging, auditing, validation, performance measurement, and modifying action inputs or outputs.

Interview tip: Define it clearly, give a small example, and mention one practical use or limitation.

Q29. What is Entity Framework Core (EF Core)? [Medium]

Answer: Entity Framework Core is Microsoft's open-source Object-Relational Mapper (ORM) for .NET. It enables developers to work with databases using C# objects instead of writing raw SQL for every operation. EF Core supports LINQ queries, migrations, change tracking, and multiple database providers such as SQL Server, PostgreSQL, MySQL, and SQLite.

Interview tip: Define it clearly, give a small example, and mention one practical use or limitation.

Q30. What is the Razor View Engine? [Medium]

Answer: The Razor View Engine is the templating engine used by ASP.NET Core MVC to generate dynamic HTML. It combines HTML with C# code using the @ syntax, allowing developers to build clean, maintainable, and strongly typed user interfaces.

Interview tip: Define it clearly, give a small example, and mention one practical use or limitation.

Q31. What is a Web API in ASP.NET Core? [Medium]

Answer: A Web API is a service that exposes application functionality over HTTP. ASP.NET Core Web APIs typically exchange data in JSON format and are commonly used by web applications, mobile apps, desktop applications, and third-party systems.

Interview tip: Define it clearly, give a small example, and mention one practical use or limitation.

Q32. What is a REST API? [Medium]

Answer: A REST API is a web service that follows Representational State Transfer (REST) principles. It uses standard HTTP methods such as GET, POST, PUT, PATCH, and DELETE to perform operations on resources and typically exchanges data in JSON format.

Interview tip: Define it clearly, give a small example, and mention one practical use or limitation.

Q33. What is Authentication in ASP.NET Core? [Hard]

Answer: Authentication is the process of verifying a user's identity before granting access to an application. ASP.NET Core supports multiple authentication methods including Cookies, JWT Bearer Tokens, OAuth 2.0, OpenID Connect, and external identity providers such as Microsoft, Google, and Facebook.

Interview tip: Define it clearly, give a small example, and mention one practical use or limitation.

Q34. What is Authorization in ASP.NET Core? [Hard]

Answer: Authorization determines what an authenticated user is allowed to access or perform. ASP.NET Core supports role-based, policy-based, and claims-based authorization using the Authorize attribute and authorization policies.

Interview tip: Define it clearly, give a small example, and mention one practical use or limitation.

Q35. What is JWT Authentication? [Hard]

Answer: JWT (JSON Web Token) Authentication is a token-based authentication mechanism where the server issues a digitally signed token after successful login. The client sends the token with each request, allowing the server to validate the user's identity without maintaining server-side session state.

Interview tip: Define it clearly, give a small example, and mention one practical use or limitation.

Q36. What is ASP.NET Core Identity? [Medium]

Answer: ASP.NET Core Identity is Microsoft's membership and authentication framework. It provides built-in support for user registration, login, password hashing, roles, claims, email confirmation, password reset, two-factor authentication, and account management.

Interview tip: Define it clearly, give a small example, and mention one practical use or limitation.

Q37. What is CORS in ASP.NET Core? [Medium]

Answer: CORS (Cross-Origin Resource Sharing) is a security feature that controls whether a web application can access resources hosted on a different domain, protocol, or port. ASP.NET Core allows developers to define CORS policies specifying allowed origins, methods, headers, and credentials.

Interview tip: Define it clearly, give a small example, and mention one practical use or limitation.

Q38. How are Sessions and Cookies used in ASP.NET Core? [Medium]

Answer: Cookies store small pieces of data on the client, while Session stores user-specific data on the server and tracks it using a session identifier. Sessions are commonly used for temporary user data, whereas cookies are often used for authentication, preferences, and persistent client-side information.

Interview tip: Define it clearly, give a small example, and mention one practical use or limitation.

Q39. What logging options are available in ASP.NET Core? [Medium]

Answer: ASP.NET Core provides a built-in logging framework that supports multiple providers including Console, Debug, Event Log, Azure Application Insights, and third-party libraries such as Serilog, NLog, and log4net. Logging helps monitor application behavior and troubleshoot issues.

Interview tip: Define it clearly, give a small example, and mention one practical use or limitation.

Q40. How is global exception handling implemented in ASP.NET Core? [Hard]

Answer: Global exception handling is commonly implemented using exception-handling middleware such as UseExceptionHandler or custom middleware. This approach captures unhandled exceptions, logs them, and returns consistent error responses without exposing sensitive implementation details.

Interview tip: Define it clearly, give a small example, and mention one practical use or limitation.

Q41. What is caching in ASP.NET Core? [Medium]

Answer: Caching stores frequently accessed data temporarily so it can be retrieved quickly without repeatedly accessing the database or external services. ASP.NET Core supports In-Memory Cache, Distributed Cache (such as Redis or SQL Server), and Response Caching to improve application performance.

Interview tip: Define it clearly, give a small example, and mention one practical use or limitation.

Q42. What is SignalR in ASP.NET Core? [Hard]

Answer: SignalR is a real-time communication library that enables bidirectional communication between clients and servers. It is commonly used for chat applications, live dashboards, notifications, online gaming, collaborative editing, and real-time monitoring systems.

Interview tip: Define it clearly, give a small example, and mention one practical use or limitation.

Q43. What are Entity Framework Core Migrations? [Medium]

Answer: EF Core Migrations are used to manage database schema changes through code. Developers create migration files that describe schema updates and apply them to the database using Entity Framework Core migration commands, keeping the database synchronized with the application's data model.

Interview tip: Define it clearly, give a small example, and mention one practical use or limitation.

Q44. What are Background Services in ASP.NET Core? [Hard]

Answer: Background Services execute long-running tasks independently of HTTP requests. They are commonly used for scheduled jobs, email processing, report generation, message queue processing, file processing, and other asynchronous background operations.

Interview tip: Define it clearly, give a small example, and mention one practical use or limitation.

Q45. What are Hosted Services in ASP.NET Core? [Hard]

Answer: Hosted Services implement the IHostedService interface or derive from BackgroundService. They start automatically when the application starts and stop gracefully during application shutdown, making them suitable for background processing and scheduled tasks.

Interview tip: Define it clearly, give a small example, and mention one practical use or limitation.

Q46. What are Minimal APIs in ASP.NET Core? [Medium]

Answer: Minimal APIs provide a lightweight way to build HTTP APIs with minimal configuration and boilerplate code. Introduced in .NET 6, they are ideal for small services, microservices, and REST APIs while still supporting dependency injection, authentication, authorization, and middleware.

Interview tip: Define it clearly, give a small example, and mention one practical use or limitation.

Q47. What are Health Checks in ASP.NET Core? [Medium]

Answer: Health Checks monitor the health and availability of an application and its dependencies such as databases, caches, message brokers, and external services. They are commonly used by load balancers, Kubernetes, and monitoring systems to determine whether an application is healthy.

Interview tip: Define it clearly, give a small example, and mention one practical use or limitation.

Q48. How can an ASP.NET Core application be deployed using Docker? [Medium]

Answer: An ASP.NET Core application can be containerized using a Dockerfile that defines the application's runtime environment. Docker containers provide consistent deployment across development, testing, and production environments and integrate well with orchestration platforms such as Kubernetes.

Interview tip: Define it clearly, give a small example, and mention one practical use or limitation.

Q49. How can ASP.NET Core applications be deployed to Azure? [Medium]

Answer: ASP.NET Core applications can be deployed to Azure App Service, Azure Container Apps, Azure Kubernetes Service (AKS), Azure Virtual Machines, or Azure Functions. Azure provides built-in support for CI/CD pipelines, monitoring, scaling, security, and application diagnostics.

Interview tip: Define it clearly, give a small example, and mention one practical use or limitation.

Q50. What are the best practices for developing ASP.NET Core applications? [Hard]

Answer: Use dependency injection throughout the application, follow SOLID principles, validate all input, implement authentication and authorization correctly, use asynchronous programming for I/O operations, centralize exception handling, optimize database queries, use caching when appropriate, secure sensitive configuration using Secret Manager or Azure Key Vault, write unit and integration tests, monitor application health, and keep the .NET runtime and dependencies up to date.

Interview tip: Define it clearly, give a small example, and mention one practical use or limitation.

Study checklist

  1. Explain the answer without reading.
  2. Write one small example.
  3. Compare framework or database version differences in official documentation.

ASP.NET Core Interview Questions and Answers

Practice one question at a time. Read the question, answer aloud, then compare your explanation with the answer.

← Back to the complete interview hub

Study method: define the concept, give a small example, and mention one practical use or limitation.

Q1. What is ASP.NET Core?

Easy

Answer: ASP.NET Core is an open-source, cross-platform web development framework developed by Microsoft for building modern web applications, RESTful APIs, cloud-native services, and microservices. It runs on Windows, Linux, and macOS and is optimized for high performance and scalability.

Interview tip: Use a short example and connect the answer to real project work.

Q2. What are the main features of ASP.NET Core?

Easy

Answer: ASP.NET Core provides cross-platform support, high performance, built-in dependency injection, middleware architecture, Razor Pages, MVC, Web API, Minimal APIs, configuration providers, logging, authentication, authorization, cloud readiness, Docker support, and seamless Azure integration.

Interview tip: Use a short example and connect the answer to real project work.

Q3. What is the difference between ASP.NET and ASP.NET Core?

Medium

Answer: ASP.NET is the traditional Microsoft web framework that runs primarily on Windows and the .NET Framework. ASP.NET Core is a modern, cross-platform framework that runs on .NET, supports Windows, Linux, and macOS, offers better performance, built-in dependency injection, and is optimized for cloud and container-based applications.

Interview tip: Use a short example and connect the answer to real project work.

Q4. What is Kestrel in ASP.NET Core?

Medium

Answer: Kestrel is the default cross-platform web server used by ASP.NET Core applications. It is lightweight, fast, and optimized for high-performance HTTP workloads. In production, it is often used behind reverse proxy servers such as IIS, Nginx, or Apache.

Interview tip: Use a short example and connect the answer to real project work.

Q5. What is the purpose of the Program.cs file in ASP.NET Core?

Medium

Answer: Program.cs is the application's entry point. It creates the web application, configures services, registers middleware, defines routing, and starts the web server. In .NET 6 and later, Program.cs uses the simplified hosting model instead of separate Startup.cs and Program.cs files.

Interview tip: Use a short example and connect the answer to real project work.

Q6. What is the request processing pipeline in ASP.NET Core?

Medium

Answer: The request processing pipeline is the sequence of middleware components that process incoming HTTP requests and outgoing responses. Each middleware can handle, modify, or pass the request to the next middleware in the pipeline.

Interview tip: Use a short example and connect the answer to real project work.

Q7. What is Middleware in ASP.NET Core?

Medium

Answer: Middleware is software that handles HTTP requests and responses within the request pipeline. Middleware components perform tasks such as routing, authentication, authorization, exception handling, logging, static file serving, CORS, and response compression.

Interview tip: Use a short example and connect the answer to real project work.

Q8. What are the advantages of ASP.NET Core?

Easy

Answer: ASP.NET Core offers excellent performance, cross-platform compatibility, built-in dependency injection, modular architecture, cloud readiness, container support, side-by-side versioning, security features, and support for modern web development patterns.

Interview tip: Use a short example and connect the answer to real project work.

Q9. What project types can be developed using ASP.NET Core?

Medium

Answer: ASP.NET Core can be used to build MVC web applications, Razor Pages applications, RESTful Web APIs, Minimal APIs, SignalR applications, gRPC services, microservices, cloud-native applications, and Blazor-hosted solutions.

Interview tip: Use a short example and connect the answer to real project work.

Q10. Why is ASP.NET Core preferred for modern enterprise applications?

Hard

Answer: ASP.NET Core is preferred because it delivers high performance, cross-platform support, built-in dependency injection, excellent security, cloud-native architecture, Docker and Kubernetes support, scalable hosting, modern API development capabilities, and seamless integration with Azure and other cloud platforms. Its modular design also simplifies testing and maintenance.

Interview tip: Use a short example and connect the answer to real project work.

Q11. What is Routing in ASP.NET Core?

Medium

Answer: Routing is the process of mapping incoming HTTP requests to controller actions, Razor Pages, Minimal APIs, or endpoints. It enables applications to respond to URLs by directing requests to the appropriate code.

Interview tip: Use a short example and connect the answer to real project work.

Q12. What is Endpoint Routing?

Medium

Answer: Endpoint Routing is the routing system introduced in ASP.NET Core that matches incoming requests to endpoints during middleware execution. It provides a unified routing model for MVC, Razor Pages, SignalR, gRPC, and Minimal APIs.

Interview tip: Use a short example and connect the answer to real project work.

Q13. Why is middleware ordering important in ASP.NET Core?

Hard

Answer: Middleware executes in the order it is registered. Incorrect ordering can prevent authentication, authorization, routing, exception handling, or static file serving from working correctly. Proper middleware order ensures requests flow through the pipeline as intended.

Interview tip: Use a short example and connect the answer to real project work.

Q14. What is appsettings.json?

Medium

Answer: appsettings.json is the primary configuration file used in ASP.NET Core. It stores application settings such as database connection strings, logging configuration, API keys, feature flags, and custom application settings in JSON format.

Interview tip: Use a short example and connect the answer to real project work.

Q15. What are environment variables in ASP.NET Core?

Medium

Answer: Environment variables allow configuration values to be supplied outside the application code. They are commonly used to store sensitive information, environment-specific settings, and deployment configuration without modifying application files.

Interview tip: Use a short example and connect the answer to real project work.

Q16. What are Configuration Providers in ASP.NET Core?

Medium

Answer: Configuration Providers load configuration data from multiple sources such as appsettings.json, appsettings.{Environment}.json, environment variables, command-line arguments, user secrets, Azure Key Vault, and custom providers.

Interview tip: Use a short example and connect the answer to real project work.

Q17. What is Dependency Injection (DI) in ASP.NET Core?

Easy

Answer: Dependency Injection is a design pattern that provides required services to a class instead of creating them inside the class. ASP.NET Core has built-in support for dependency injection, improving modularity, testability, and maintainability.

Interview tip: Use a short example and connect the answer to real project work.

Q18. How are services registered in ASP.NET Core?

Medium

Answer: Services are registered in the dependency injection container using methods such as AddSingleton(), AddScoped(), and AddTransient(). These registrations are typically performed in Program.cs during application startup.

Interview tip: Use a short example and connect the answer to real project work.

Q19. What are the service lifetimes in ASP.NET Core?

Hard

Answer: ASP.NET Core supports three service lifetimes: Singleton creates one instance for the application's lifetime, Scoped creates one instance per HTTP request, and Transient creates a new instance every time the service is requested.

Interview tip: Use a short example and connect the answer to real project work.

Q20. What is the Options Pattern in ASP.NET Core?

Hard

Answer: The Options Pattern provides a strongly typed way to access configuration values. Configuration sections from files such as appsettings.json are bound to C# classes, making configuration easier to manage, validate, and test.

Interview tip: Use a short example and connect the answer to real project work.

Q21. What is the MVC architecture in ASP.NET Core?

Medium

Answer: MVC (Model-View-Controller) is a design pattern that separates an application into three components. The Model manages application data and business logic, the View displays the user interface, and the Controller handles HTTP requests, processes user input, and coordinates communication between the Model and View.

Interview tip: Use a short example and connect the answer to real project work.

Q22. What are Razor Pages in ASP.NET Core?

Medium

Answer: Razor Pages is a page-based programming model for building web applications. Each page contains a Razor (.cshtml) file and an associated PageModel class, making it easier to develop applications that are centered around individual pages rather than controllers.

Interview tip: Use a short example and connect the answer to real project work.

Q23. What is a Controller in ASP.NET Core MVC?

Easy

Answer: A Controller is a class responsible for handling incoming HTTP requests, processing business logic, interacting with services or models, and returning responses such as Views, JSON data, files, or HTTP status codes.

Interview tip: Use a short example and connect the answer to real project work.

Q24. What is an Action Method?

Easy

Answer: An Action Method is a public method inside a controller that responds to an HTTP request. It processes the request and returns an IActionResult or another supported response type such as a View, JSON object, redirect, or file.

Interview tip: Use a short example and connect the answer to real project work.

Q25. What is Model Binding in ASP.NET Core?

Medium

Answer: Model Binding automatically maps data from HTTP requests, such as route values, query strings, form fields, and request bodies, to action method parameters or model objects. This reduces manual parsing and simplifies request processing.

Interview tip: Use a short example and connect the answer to real project work.

Q26. What is Model Validation?

Medium

Answer: Model Validation verifies that incoming data satisfies validation rules before it is processed. ASP.NET Core commonly uses data annotation attributes such as Required, StringLength, Range, EmailAddress, and RegularExpression to validate model properties automatically.

Interview tip: Use a short example and connect the answer to real project work.

Q27. What are Filters in ASP.NET Core?

Hard

Answer: Filters execute code before or after specific stages of request processing. They provide a clean way to implement cross-cutting concerns such as authorization, logging, exception handling, result modification, resource management, and action execution.

Interview tip: Use a short example and connect the answer to real project work.

Q28. What is an Action Filter?

Hard

Answer: An Action Filter is a type of filter that executes code before and after an action method runs. It is commonly used for logging, auditing, validation, performance measurement, and modifying action inputs or outputs.

Interview tip: Use a short example and connect the answer to real project work.

Q29. What is Entity Framework Core (EF Core)?

Medium

Answer: Entity Framework Core is Microsoft's open-source Object-Relational Mapper (ORM) for .NET. It enables developers to work with databases using C# objects instead of writing raw SQL for every operation. EF Core supports LINQ queries, migrations, change tracking, and multiple database providers such as SQL Server, PostgreSQL, MySQL, and SQLite.

Interview tip: Use a short example and connect the answer to real project work.

Q30. What is the Razor View Engine?

Medium

Answer: The Razor View Engine is the templating engine used by ASP.NET Core MVC to generate dynamic HTML. It combines HTML with C# code using the @ syntax, allowing developers to build clean, maintainable, and strongly typed user interfaces.

Interview tip: Use a short example and connect the answer to real project work.

Q31. What is a Web API in ASP.NET Core?

Medium

Answer: A Web API is a service that exposes application functionality over HTTP. ASP.NET Core Web APIs typically exchange data in JSON format and are commonly used by web applications, mobile apps, desktop applications, and third-party systems.

Interview tip: Use a short example and connect the answer to real project work.

Q32. What is a REST API?

Medium

Answer: A REST API is a web service that follows Representational State Transfer (REST) principles. It uses standard HTTP methods such as GET, POST, PUT, PATCH, and DELETE to perform operations on resources and typically exchanges data in JSON format.

Interview tip: Use a short example and connect the answer to real project work.

Q33. What is Authentication in ASP.NET Core?

Hard

Answer: Authentication is the process of verifying a user's identity before granting access to an application. ASP.NET Core supports multiple authentication methods including Cookies, JWT Bearer Tokens, OAuth 2.0, OpenID Connect, and external identity providers such as Microsoft, Google, and Facebook.

Interview tip: Use a short example and connect the answer to real project work.

Q34. What is Authorization in ASP.NET Core?

Hard

Answer: Authorization determines what an authenticated user is allowed to access or perform. ASP.NET Core supports role-based, policy-based, and claims-based authorization using the Authorize attribute and authorization policies.

Interview tip: Use a short example and connect the answer to real project work.

Q35. What is JWT Authentication?

Hard

Answer: JWT (JSON Web Token) Authentication is a token-based authentication mechanism where the server issues a digitally signed token after successful login. The client sends the token with each request, allowing the server to validate the user's identity without maintaining server-side session state.

Interview tip: Use a short example and connect the answer to real project work.

Q36. What is ASP.NET Core Identity?

Medium

Answer: ASP.NET Core Identity is Microsoft's membership and authentication framework. It provides built-in support for user registration, login, password hashing, roles, claims, email confirmation, password reset, two-factor authentication, and account management.

Interview tip: Use a short example and connect the answer to real project work.

Q37. What is CORS in ASP.NET Core?

Medium

Answer: CORS (Cross-Origin Resource Sharing) is a security feature that controls whether a web application can access resources hosted on a different domain, protocol, or port. ASP.NET Core allows developers to define CORS policies specifying allowed origins, methods, headers, and credentials.

Interview tip: Use a short example and connect the answer to real project work.

Q38. How are Sessions and Cookies used in ASP.NET Core?

Medium

Answer: Cookies store small pieces of data on the client, while Session stores user-specific data on the server and tracks it using a session identifier. Sessions are commonly used for temporary user data, whereas cookies are often used for authentication, preferences, and persistent client-side information.

Interview tip: Use a short example and connect the answer to real project work.

Q39. What logging options are available in ASP.NET Core?

Medium

Answer: ASP.NET Core provides a built-in logging framework that supports multiple providers including Console, Debug, Event Log, Azure Application Insights, and third-party libraries such as Serilog, NLog, and log4net. Logging helps monitor application behavior and troubleshoot issues.

Interview tip: Use a short example and connect the answer to real project work.

Q40. How is global exception handling implemented in ASP.NET Core?

Hard

Answer: Global exception handling is commonly implemented using exception-handling middleware such as UseExceptionHandler or custom middleware. This approach captures unhandled exceptions, logs them, and returns consistent error responses without exposing sensitive implementation details.

Interview tip: Use a short example and connect the answer to real project work.

Q41. What is caching in ASP.NET Core?

Medium

Answer: Caching stores frequently accessed data temporarily so it can be retrieved quickly without repeatedly accessing the database or external services. ASP.NET Core supports In-Memory Cache, Distributed Cache (such as Redis or SQL Server), and Response Caching to improve application performance.

Interview tip: Use a short example and connect the answer to real project work.

Q42. What is SignalR in ASP.NET Core?

Hard

Answer: SignalR is a real-time communication library that enables bidirectional communication between clients and servers. It is commonly used for chat applications, live dashboards, notifications, online gaming, collaborative editing, and real-time monitoring systems.

Interview tip: Use a short example and connect the answer to real project work.

Q43. What are Entity Framework Core Migrations?

Medium

Answer: EF Core Migrations are used to manage database schema changes through code. Developers create migration files that describe schema updates and apply them to the database using Entity Framework Core migration commands, keeping the database synchronized with the application's data model.

Interview tip: Use a short example and connect the answer to real project work.

Q44. What are Background Services in ASP.NET Core?

Hard

Answer: Background Services execute long-running tasks independently of HTTP requests. They are commonly used for scheduled jobs, email processing, report generation, message queue processing, file processing, and other asynchronous background operations.

Interview tip: Use a short example and connect the answer to real project work.

Q45. What are Hosted Services in ASP.NET Core?

Hard

Answer: Hosted Services implement the IHostedService interface or derive from BackgroundService. They start automatically when the application starts and stop gracefully during application shutdown, making them suitable for background processing and scheduled tasks.

Interview tip: Use a short example and connect the answer to real project work.

Q46. What are Minimal APIs in ASP.NET Core?

Medium

Answer: Minimal APIs provide a lightweight way to build HTTP APIs with minimal configuration and boilerplate code. Introduced in .NET 6, they are ideal for small services, microservices, and REST APIs while still supporting dependency injection, authentication, authorization, and middleware.

Interview tip: Use a short example and connect the answer to real project work.

Q47. What are Health Checks in ASP.NET Core?

Medium

Answer: Health Checks monitor the health and availability of an application and its dependencies such as databases, caches, message brokers, and external services. They are commonly used by load balancers, Kubernetes, and monitoring systems to determine whether an application is healthy.

Interview tip: Use a short example and connect the answer to real project work.

Q48. How can an ASP.NET Core application be deployed using Docker?

Medium

Answer: An ASP.NET Core application can be containerized using a Dockerfile that defines the application's runtime environment. Docker containers provide consistent deployment across development, testing, and production environments and integrate well with orchestration platforms such as Kubernetes.

Interview tip: Use a short example and connect the answer to real project work.

Q49. How can ASP.NET Core applications be deployed to Azure?

Medium

Answer: ASP.NET Core applications can be deployed to Azure App Service, Azure Container Apps, Azure Kubernetes Service (AKS), Azure Virtual Machines, or Azure Functions. Azure provides built-in support for CI/CD pipelines, monitoring, scaling, security, and application diagnostics.

Interview tip: Use a short example and connect the answer to real project work.

Q50. What are the best practices for developing ASP.NET Core applications?

Hard

Answer: Use dependency injection throughout the application, follow SOLID principles, validate all input, implement authentication and authorization correctly, use asynchronous programming for I/O operations, centralize exception handling, optimize database queries, use caching when appropriate, secure sensitive configuration using Secret Manager or Azure Key Vault, write unit and integration tests, monitor application health, and keep the .NET runtime and dependencies up to date.

Interview tip: Use a short example and connect the answer to real project work.

Quick revision checklist

  1. Explain the answer without reading.
  2. Write one small example.
  3. Review platform or version differences in official documentation.

logoblog

No comments:

Post a Comment

Please do not enter any spam link in the comment box.