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