Master technical and career interviews with structured answers—short definition, real examples, pitfalls, and how to answer in 60–90 seconds.
Short answer: A filter is a component that allows logic to be executed before or after parts of the request pipeline, such as authorization, action execution, or result processing. Real-world example (ShopNest) A ShopNes…
Short answer: Filters are ASP.NET Core’s plug-in points that allow you to inject logic before or after specific pipeline stages such as: Authorization Resource execution Action execution Results processing Exception hand…
Short answer: Middleware is a component in the HTTP request pipeline that can: Handle requests, Pass requests to the next middleware, Or short-circuit the pipeline. Middleware can: Perform actions before and/or after the…
Short answer: Action filters wrap the action method; result filters wrap the returned result (like ObjectResult or ViewResult). Example code Action filters wrap the action method; result filters wrap the returned result…
Short answer: RequestDelegate is a delegate representing the next middleware in the pipeline: public delegate Task RequestDelegate(HttpContext context); In custom middleware, it allows passing control to the next compone…
Short answer: The sequence in which filters run. Lower Order value = earlier execution. Real-world example (ShopNest) A ShopNest ValidateModelAttribute runs before actions and returns 400 if ModelState is invalid—same ru…
Short answer: Dependency Injection (DI) is a design pattern that allows you to inject dependencies (services) into classes instead of hard-coding them. Real-world example (ShopNest) ShopNest registers AppDbContext as Sco…
Short answer: Used for filters that require custom instantiation logic. Real-world example (ShopNest) A ShopNest ValidateModelAttribute runs before actions and returns 400 if ModelState is invalid—same rule for every con…
Short answer: MVC (Model-View-Controller) is a pattern for organizing code into: Model: Data and business logic View: UI rendering Controller: Input handling and app flow Built on a modular, cross-platform framework. Use…
Short answer: How does it differ from MVC in “older” ASP.NET? MVC (Model-View-Controller) is a pattern for organizing code into: Model: Data and business logic View: UI rendering Controller: Input handling and app flow B…
Short answer: SP.NET Core 2.0. Each .cshtml file has an associated PageModel class (like a view + controller combined). Best for simple UI-focused apps or CRUD pages. ✅ Use Razor Pages for: Simpler, page-focused apps ✅ U…
Short answer: When to use Razor Pages instead of MVC? Razor Pages is a page-based programming model introduced in ASP.NET Core 2.0. Each .cshtml file has an associated PageModel class (like a view + controller combined).…
Short answer: REST (Representational State Transfer) is an architectural style for building scalable web services. RESTful APIs follow standard HTTP methods (GET, POST, PUT, DELETE) and stateless communication. Real-worl…
Short answer: SP.NET Core. ✅ Benefits: Automatic model validation Infer [FromBody] / [FromQuery], etc. 400 BadRequest returned automatically if model state is invalid. Improved parameter binding behavior Real-world examp…
Short answer: The [ApiController] attribute is used to denote Web API controllers in ASP.NET Core. ✅ Benefits: Automatic model validation Infer [FromBody] / [FromQuery], etc. 400 BadRequest returned automatically if mode…
Short answer: ction (What are you allowed to do?) In ASP.NET Core, both are handled via middleware and attributes like [Authorize], roles, nd policies. Real-world example (ShopNest) A ShopNest checkout request flows thro…
Short answer: Authentication: Verifying the identity of a user (Who are you?) Authorization: Determining if the authenticated user has permission to perform an action (What are you allowed to do?) In ASP.NET Core, both a…
Short answer: uthorizationHandler<MinimumAgeRequirement> { protected override Task HandleRequirementAsync(...) { // logic } } Register in DI and use with [Authorize(Policy = "...")]. Real-world example (S…
Short answer: Filters run in a specific order depending on their type: Authorization filters run first. Explain a bit more Resource filters run next. Model binding happens after resource filters. Action filters run aroun…
Short answer: Filters receive context objects (e.g., ActionExecutingContext) providing: HTTP context and request data. Access to action parameters. Ability to modify or cancel execution (e.g., short-circuit). Access to t…
Short answer: Filters can short-circuit by setting the result early, preventing further execution: public void OnActionExecuting(ActionExecutingContext context) Example code { if (!IsAuthorized()) { context.Result = new…
Short answer: CORS (Cross-Origin Resource Sharing) is a browser security feature that restricts web pages from making requests to a different domain than the one that served the web page, to prevent cross-site attacks. C…
Short answer: IActionResult: Represents a non-generic result of an action method. Can return any HTTP response (Ok, NotFound, Redirect, etc.). ActionResult<T>: Combines a result with a typed value (T). It allows re…
Short answer: In .NET 5 and earlier, Startup configures services and middleware. In .NET 6+ minimal hosting model, the Program.cs file combines service registration and middleware setup with a simplified, top-level state…
Short answer: Minimal APIs are lightweight endpoints defined with top-level statements, no controller classes. Ideal for microservices or simple APIs. Less ceremony and fewer files. Controllers provide richer features (f…
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
Short answer: A filter is a component that allows logic to be executed before or after parts of the request pipeline, such as authorization, action execution, or result processing.
A ShopNest ValidateModelAttribute runs before actions and returns 400 if ModelState is invalid—same rule for every controller.
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
Short answer: Filters are ASP.NET Core’s plug-in points that allow you to inject logic before or after specific pipeline stages such as: Authorization Resource execution Action execution Results processing Exception handling They help you implement cross-cutting concerns without cluttering controllers or actions.
In enterprise systems, filters are indispensable for: Logging Validation Authorization Error handling Performance profiling Policy enforcement
A ShopNest ValidateModelAttribute runs before actions and returns 400 if ModelState is invalid—same rule for every controller.
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
Short answer: Middleware is a component in the HTTP request pipeline that can: Handle requests, Pass requests to the next middleware, Or short-circuit the pipeline. Middleware can: Perform actions before and/or after the next middleware executes. Be used for logging, authentication, error handling, etc. Middleware executes in the order it's added in Program.cs.
ShopNest pipeline order matters: exception handling → HTTPS → auth → authorization → endpoints. Auth must run before protected APIs.
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
Short answer: Action filters wrap the action method; result filters wrap the returned result (like ObjectResult or ViewResult).
Action filters wrap the action method; result filters wrap the returned result (like ObjectResult or ViewResult).
ShopNest registers AppDbContext as Scoped and IMemoryCache as Singleton. Putting DbContext in a Singleton causes threading bugs.
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
Short answer: RequestDelegate is a delegate representing the next middleware in the pipeline: public delegate Task RequestDelegate(HttpContext context); In custom middleware, it allows passing control to the next component.
A ShopNest checkout request flows through middleware, hits a minimal API or controller, uses scoped services, and returns ProblemDetails on errors.
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
Short answer: The sequence in which filters run. Lower Order value = earlier execution.
A ShopNest ValidateModelAttribute runs before actions and returns 400 if ModelState is invalid—same rule for every controller.
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
Short answer: Dependency Injection (DI) is a design pattern that allows you to inject dependencies (services) into classes instead of hard-coding them.
ShopNest registers AppDbContext as Scoped and IMemoryCache as Singleton. Putting DbContext in a Singleton causes threading bugs.
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
Short answer: Used for filters that require custom instantiation logic.
A ShopNest ValidateModelAttribute runs before actions and returns 400 if ModelState is invalid—same rule for every controller.
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
Short answer: MVC (Model-View-Controller) is a pattern for organizing code into: Model: Data and business logic View: UI rendering Controller: Input handling and app flow Built on a modular, cross-platform framework. Uses dependency injection by default. Unified Web API + MVC pipeline. Lightweight and middleware-based request processing.
A ShopNest checkout request flows through middleware, hits a minimal API or controller, uses scoped services, and returns ProblemDetails on errors.
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
Short answer: How does it differ from MVC in “older” ASP.NET? MVC (Model-View-Controller) is a pattern for organizing code into: Model: Data and business logic View: UI rendering Controller: Input handling and app flow Built on a modular, cross-platform framework. Uses dependency injection by default. Unified Web API + MVC pipeline. Lightweight and middleware-based request processing.
A ShopNest checkout request flows through middleware, hits a minimal API or controller, uses scoped services, and returns ProblemDetails on errors.
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
Short answer: SP.NET Core 2.0. Each .cshtml file has an associated PageModel class (like a view + controller combined). Best for simple UI-focused apps or CRUD pages. ✅ Use Razor Pages for: Simpler, page-focused apps ✅ Use MVC for: Complex, controller-based routing or large, structured apps
A ShopNest checkout request flows through middleware, hits a minimal API or controller, uses scoped services, and returns ProblemDetails on errors.
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
Short answer: When to use Razor Pages instead of MVC? Razor Pages is a page-based programming model introduced in ASP.NET Core 2.0. Each .cshtml file has an associated PageModel class (like a view + controller combined). Best for simple UI-focused apps or CRUD pages. ✅ Use Razor Pages for: Simpler, page-focused apps ✅ Use MVC for: Complex, controller-based routing or large, structured apps
A ShopNest checkout request flows through middleware, hits a minimal API or controller, uses scoped services, and returns ProblemDetails on errors.
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
Short answer: REST (Representational State Transfer) is an architectural style for building scalable web services. RESTful APIs follow standard HTTP methods (GET, POST, PUT, DELETE) and stateless communication.
A ShopNest checkout request flows through middleware, hits a minimal API or controller, uses scoped services, and returns ProblemDetails on errors.
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
Short answer: SP.NET Core. ✅ Benefits: Automatic model validation Infer [FromBody] / [FromQuery], etc. 400 BadRequest returned automatically if model state is invalid. Improved parameter binding behavior
A ShopNest checkout request flows through middleware, hits a minimal API or controller, uses scoped services, and returns ProblemDetails on errors.
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
Short answer: The [ApiController] attribute is used to denote Web API controllers in ASP.NET Core. ✅ Benefits: Automatic model validation Infer [FromBody] / [FromQuery], etc. 400 BadRequest returned automatically if model state is invalid. Improved parameter binding behavior
A ShopNest checkout request flows through middleware, hits a minimal API or controller, uses scoped services, and returns ProblemDetails on errors.
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
Short answer: ction (What are you allowed to do?) In ASP.NET Core, both are handled via middleware and attributes like [Authorize], roles, nd policies.
A ShopNest checkout request flows through middleware, hits a minimal API or controller, uses scoped services, and returns ProblemDetails on errors.
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
Short answer: Authentication: Verifying the identity of a user (Who are you?) Authorization: Determining if the authenticated user has permission to perform an action (What are you allowed to do?) In ASP.NET Core, both are handled via middleware and attributes like [Authorize], roles, and policies.
A ShopNest checkout request flows through middleware, hits a minimal API or controller, uses scoped services, and returns ProblemDetails on errors.
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
Short answer: uthorizationHandler<MinimumAgeRequirement> { protected override Task HandleRequirementAsync(...) { // logic } } Register in DI and use with [Authorize(Policy = "...")].
A ShopNest checkout request flows through middleware, hits a minimal API or controller, uses scoped services, and returns ProblemDetails on errors.
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
Short answer: Filters run in a specific order depending on their type: Authorization filters run first.
Resource filters run next. Model binding happens after resource filters. Action filters run around the action execution. Exception filters handle exceptions thrown during action or result execution. Result filters run around result execution. Within each type, filters can be ordered by their Order property and whether they are global, controller-level, or action-level.
A ShopNest ValidateModelAttribute runs before actions and returns 400 if ModelState is invalid—same rule for every controller.
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
Short answer: Filters receive context objects (e.g., ActionExecutingContext) providing: HTTP context and request data. Access to action parameters. Ability to modify or cancel execution (e.g., short-circuit). Access to the result or exceptions. Ability to set result or modify response. This allows filters to inspect, modify, or block processing at their stage.
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
Short answer: Filters can short-circuit by setting the result early, preventing further execution: public void OnActionExecuting(ActionExecutingContext context)
{
if (!IsAuthorized())
{
context.Result = new UnauthorizedResult(); // stops pipeline here }
} This prevents action execution and later filters from running.
A ShopNest ValidateModelAttribute runs before actions and returns 400 if ModelState is invalid—same rule for every controller.
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
Short answer: CORS (Cross-Origin Resource Sharing) is a browser security feature that restricts web pages from making requests to a different domain than the one that served the web page, to prevent cross-site attacks. CORS defines a way for servers to allow controlled access to resources from a different origin.
A ShopNest checkout request flows through middleware, hits a minimal API or controller, uses scoped services, and returns ProblemDetails on errors.
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
Short answer: IActionResult: Represents a non-generic result of an action method. Can return any HTTP response (Ok, NotFound, Redirect, etc.). ActionResult<T>: Combines a result with a typed value (T). It allows returning typed data or an HTTP response. Improves clarity and enables better OpenAPI docs.
ShopNest registers AppDbContext as Scoped and IMemoryCache as Singleton. Putting DbContext in a Singleton causes threading bugs.
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
Short answer: In .NET 5 and earlier, Startup configures services and middleware. In .NET 6+ minimal hosting model, the Program.cs file combines service registration and middleware setup with a simplified, top-level statement style. Startup can still be used for organization, but not required.
A ShopNest checkout request flows through middleware, hits a minimal API or controller, uses scoped services, and returns ProblemDetails on errors.
ASP.NET Core ASP.NET Core Tutorial · ASP.NET Core
Short answer: Minimal APIs are lightweight endpoints defined with top-level statements, no controller classes. Ideal for microservices or simple APIs. Less ceremony and fewer files. Controllers provide richer features (filters, model binding, action results).
ShopNest registers AppDbContext as Scoped and IMemoryCache as Singleton. Putting DbContext in a Singleton causes threading bugs.
Install Toolliyo like an app Free
Home-screen access to tutorials, coding practice & career tools — no app store needed.
On iPhone/iPad: tap Share then Add to Home Screen.