โ† All ASP.NET Core Flashcard Decks

Middleware & Pipeline Flashcards

6 cards from real ASP.NET Core practice questions. Tap to flip, then mark Knew It or Still Learning โ€” missed cards come back until you master them.

Read the first 6 Middleware & Pipeline flashcards as text
  1. Which built-in middleware handles serving static files in ASP.NET Core?

    Answer: UseStaticFiles()

    UseStaticFiles() enables serving files from the wwwroot folder by default.

  2. What is the role of the IApplicationBuilder interface in ASP.NET Core?

    Answer: It configures the request processing pipeline

    IApplicationBuilder provides methods like Use, Run, and Map to compose the middleware pipeline.

  3. Which middleware should be placed early in the pipeline to catch unhandled exceptions?

    Answer: UseExceptionHandler()

    UseExceptionHandler() wraps later middleware so it can catch and handle exceptions from any downstream component.

  4. What does app.UseWhen() do in ASP.NET Core?

    Answer: Conditionally branches the pipeline and rejoins it

    app.UseWhen() creates a conditional branch that rejoins the main pipeline after the branch completes.

  5. Which middleware is responsible for setting HTTP Strict Transport Security headers?

    Answer: UseHsts()

    UseHsts() adds the Strict-Transport-Security header instructing browsers to only use HTTPS.

  6. In convention-based middleware, what is the required method signature for the middleware's main method?

    Answer: public Task InvokeAsync(HttpContext context, RequestDelegate next)

    Convention-based middleware requires an InvokeAsync(HttpContext, RequestDelegate) method that ASP.NET Core discovers by convention.