ASP.NET Core Cheat Sheet 2026

The 30 highest-yield ASP.NET Core facts, distilled from real exam questions. Print it, save it as a PDF, or study it here — free, no sign-up.

35 questions
45 min time limit
75.00% to pass
  1. What does [Area("Admin")] attribute do on a controller? Associates the controller with the Admin routing area for URL organization
  2. What does UseHsts() middleware do? Adds HTTP Strict Transport Security headers
  3. What method is used to add middleware to the ASP.NET Core request pipeline? app.UseMiddleware()
  4. Which ASP.NET Core method is used to register all services with the DI container? ConfigureServices() in Startup or builder.Services in Program.cs
  5. What does DbSet represent in Entity Framework Core? A collection of all entities of a given type that can be queried and saved
  6. What does calling Problem() helper method return in an ASP.NET Core API controller? An ObjectResult with ProblemDetails payload and appropriate status code
  7. Which Status code does the RedirectToAction() method represent? 302
  8. Which method registers a service with Transient lifetime in ASP.NET Core DI? services.AddTransient()
  9. What is the difference between app.Use() and app.Run() middleware registration? Use() can call next middleware; Run() is terminal and cannot
  10. Which method adds Serilog as the host logging provider in the minimal hosting model? builder.Host.UseSerilog()
  11. What is the lowest severity log level in ASP.NET Core logging? Trace
  12. Which method creates an inline middleware using a delegate? app.Use()
  13. Which Tag Helper renders a client-side validation error message for a specific model property?
  14. What does the [Key] attribute do on an entity property in EF Core? Designates the property as the primary key for the entity
  15. Which environment variable sets the current environment in ASP.NET Core? ASPNETCORE_ENVIRONMENT
  16. Middlewares can be set up in _____ Startup class's method. Configure
  17. Which EF Core method applies pending migrations to the database? dotnet ef database update
  18. Which mechanisms can pass data from a Razor Pages PageModel to its view beyond the strongly-typed Model property? ViewData, ViewBag, and TempData are all valid options
  19. What is the IHostEnvironment interface used for? Accessing environment name, content root, and web root paths
  20. Which file is the primary configuration source in an ASP.NET Core application? appsettings.json
  21. In which interface must a custom middleware class implement its logic? IMiddleware with InvokeAsync method
  22. What is the role of UseEndpoints() in ASP.NET Core routing? It executes the endpoints matched by UseRouting()
  23. What is a logging scope in ASP.NET Core? A context block that adds additional structured data to all log messages within it
  24. Which EF Core loading strategy fetches related entities in the same query using a JOIN? Eager loading with Include()
  25. What is the purpose of the IOptions interface in ASP.NET Core? To inject strongly typed configuration settings bound to a class
  26. What does AsNoTracking() do in an EF Core LINQ query? Returns entities without adding them to the change tracker, improving read performance
  27. How do you perform options validation in ASP.NET Core? Use services.AddOptions().ValidateDataAnnotations() or implement IValidateOptions
  28. Which handler method signature handles HTTP GET requests in a Razor Pages PageModel? Both OnGet() and OnGetAsync() are valid
  29. What route token represents an action name in a conventional route template? {action}
  30. How do you configure cookie authentication in ASP.NET Core? services.AddAuthentication().AddCookie()