ASP.NET Core (Blazor)

This section documents ASP.NET Core on .NET 10 (LTS), the current release — the minimal hosting model, the middleware pipeline, dependency injection, Minimal APIs, MVC & Razor Pages, Blazor with the current render modes, SignalR and gRPC, EF Core, ASP.NET Core Identity and policy-based authorization, output caching, rate limiting, and Native-AOT-aware building — as described by the official documentation at Microsoft Learn, which is the reference these pages are written and verified against.

This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production. .NET ships a major release every November and its APIs continue to evolve: the examples here target .NET 10 / C# 14.

This section’s bibliography lists the reference material consulted while preparing these pages.

This sub-section documents ASP.NET Core — the cross-platform, open-source framework unifying MVC, Razor Pages, Web APIs, Blazor, SignalR, and gRPC on one HTTP server and one dependency-injection container. It is a complete rewrite of the older .NET Framework "ASP.NET"; the two frameworks share almost no API, and each has its own sub-section of this site (see the ASP.NET reference landing page for the choice between them).

Every page here targets .NET 10 (LTS) / C# 14, the current release, as its anchor version — the minimal hosting model, the current Blazor render modes, and the APIs described throughout are the .NET 10 shape of each feature, called out explicitly wherever an older/newer .NET version behaves differently.

If you are new to ASP.NET Core, start with Getting Started with ASP.NET Core, then Request Pipeline and Middleware and Minimal APIs, then work down the list or jump to what you need.

What’s covered

Getting started

  • Getting Started with ASP.NET Core — what ASP.NET Core is, the .NET 10 LTS release cadence, the SDK and dotnet CLI, the project layout, the minimal hosting model, and how to choose an app model.

Fundamentals

  • Request Pipeline and Middleware — the pipeline as an ordered chain of RequestDelegate`s, `Use / Run / Map, the recommended order, the built-in middleware, writing custom middleware, and HttpContext.

  • Hosting, Servers, and Environments — WebApplication vs. the Generic Host, background services, Kestrel / IIS / HTTP.sys, reverse proxies and forwarded headers, and environment-based configuration.

  • Configuration and the Options Pattern — configuration providers and precedence, reading IConfiguration, binding to typed options, IOptions vs. IOptionsSnapshot vs. IOptionsMonitor, named options, and options validation.

  • Dependency Injection — the built-in container, service lifetimes and the captive-dependency pitfall, registration techniques including keyed services, consuming services across the framework, and replacing the container.

  • Routing — the match/execute model, route templates and constraints, the Map methods and route groups, attribute vs. conventional routing, URL generation, and short-circuit routes.

  • Filters and the MVC Pipeline — the MVC/Razor Pages filter pipeline (authorization, resource, action, exception, result, and page filters), order and scope, short-circuiting, DI in filters, and filters vs. middleware vs. endpoint filters.

  • Static Files and Asset Delivery — UseStaticFiles vs. MapStaticAssets, static web assets, fingerprinting and compression, ImportMap, wwwroot conventions, and CDN/cache-control strategy.

  • HTTP Client and Resilience — IHttpClientFactory, named and typed clients, message handler chains, the resilience/Polly standard handler, timeouts, retries, circuit breakers, HttpClient pitfalls, and Refit/Kiota-generated clients.

Building HTTP APIs & apps

  • Minimal APIs — Map methods and route groups, parameter binding, IResult and TypedResults, endpoint filters, validation, error handling, and a full worked CRUD example.

  • MVC Controllers and Views — controllers and action results, conventional vs. attribute routing, ViewData/ViewBag/TempData, areas, and view discovery.

  • Razor Syntax and Tag Helpers — Razor syntax, _ViewImports/_ViewStart, layouts, sections, partial views, view components, built-in and custom Tag Helpers, and HTML encoding.

  • Razor Pages — PageModel, handler selection and naming, @page route templates, [BindProperty], page conventions, filters, and when to prefer it over MVC.

  • Model Binding and Validation — binding sources and order, binding attributes, custom model binders, DataAnnotations and custom validation, and client-side validation.

  • Web API Controllers — ApiController conventions, action return types, content negotiation and System.Text.Json options, ProblemDetails, DTOs, CORS, and the minimal-API-vs-controller trade-off.

  • OpenAPI and API Versioning — the built-in Microsoft.AspNetCore.OpenApi package, OpenAPI 3.1 and JSON Schema 2020-12 defaults, YAML output, XML-doc integration, document/operation/schema transformers, Scalar/Swagger UI, client generation, and Asp.Versioning.*.

Interactive & real-time UI

  • Blazor Overview and Render Modes — what Blazor is, the Blazor Web App project layout, Static/streaming SSR, Interactive Server/WebAssembly/Auto, per-component interactivity, standalone Blazor WebAssembly, prerendering, and choosing a mode.

  • Blazor Components and Lifecycle — .razor components, parameters and cascading values, RenderFragment, the full lifecycle, StateHasChanged, @key, built-in components, and CSS isolation.

  • Blazor Data Binding, Forms, and Validation — @bind and its modifiers, EventCallback, EditForm/EditContext, the Input* components, DataAnnotationsValidator, [ValidatableType], and SSR form handling.

  • Blazor Routing and Navigation — @page route templates, the Router, NavigationManager, [SupplyParameterFromQuery], NavLink, navigation locks, NotFoundPage, enhanced navigation, and layouts.

  • Blazor State Management — state per render mode, PersistentComponentState and [PersistentState], circuit state persistence across reconnects, DI-scoped state containers, browser storage, state in the URL, and state-management libraries.

  • Blazor JavaScript Interop — IJSRuntime, JS modules and collocated JS, JS-to-.NET calls with [JSInvokable], InvokeConstructorAsync/GetValue/SetValue, synchronous WebAssembly interop, and ElementReference.

  • Blazor Security — AuthenticationStateProvider, AuthorizeView/[Authorize], why WebAssembly auth is never a trust boundary, ASP.NET Core Identity, OIDC, token handling, passkeys, and reconnection UI.

  • Blazor WebAssembly, Hybrid, and Deployment — the WebAssembly runtime, trimming/AOT/SIMD, lazy loading, fingerprinted assets, PWAs, hosting standalone vs. hosted WASM, Blazor Hybrid with .NET MAUI, and Razor class libraries.

  • Blazor Testing and Diagnostics — bUnit, Playwright end-to-end testing, debugging Server vs. WebAssembly, Hot Reload, metrics/tracing diagnostics, and common production issues.

  • SignalR — hubs, strongly typed hubs, clients and transports, groups and users, streaming, authentication, and scale-out with Redis/Azure SignalR.

  • gRPC — contract-first .proto definitions, the four call types, interceptors, gRPC-Web, JSON transcoding, deadlines/cancellation, the client factory, and gRPC vs. REST.

Data

  • Data Access with EF Core — registering a DbContext, querying and change tracking, saving and concurrency, modelling with the Fluent API, migrations, resiliency, and Dapper as an alternative.

Security

  • Authentication and ASP.NET Core Identity — authentication schemes and handlers, cookie and JWT bearer authentication, OAuth 2.0 / OpenID Connect, ASP.NET Core Identity for local accounts, and the Identity API endpoints.

  • Authorization — the Authorize attribute, role and claims checks, policy-based authorization with requirements and handlers, resource-based authorization, and advanced policy features.

  • Security Hardening — the Data Protection API, HTTPS and HSTS, secret management, CORS, antiforgery / CSRF, XSS and Content Security Policy, open-redirect and SQL-injection avoidance, and an OWASP Top 10 map.

Operations

  • Error Handling, Logging, and Observability — UseExceptionHandler and IExceptionHandler, the Operation Result pattern, structured logging with ILogger, HTTP logging, health checks, and metrics and tracing with OpenTelemetry.

  • Performance and Caching — response vs. output caching, IMemoryCache / IDistributedCache / HybridCache, rate limiting, request timeouts and compression, outbound-call resilience, and an EF Core and runtime checklist.

Architecture & delivery

  • Architecture and Patterns — SOLID and design principles, layering and Clean Architecture, DTO mapping, cross-cutting patterns in DI, CQRS and the mediator pattern, and vertical slices vs. modular monoliths.

  • Testing — the xUnit test project and test doubles, unit-testing controllers, handlers, middleware and validators, integration testing with WebApplicationFactory, test infrastructure, and end-to-end and load testing.

  • Deployment — dotnet publish options, IIS, Linux with Nginx and systemd, containers, running behind a proxy or load balancer, production config and secrets, and a CI/CD pipeline.

Cloud-native

  • .NET Aspire and Cloud-Native Development — the AppHost and ServiceDefaults projects, resources and references, service discovery, the dashboard, integrations, local orchestration vs. deployment, and how Aspire relates to Docker Compose/Kubernetes.

UI libraries

  • UI Component Libraries — styling an ASP.NET Core UI (Bootstrap, Tailwind, Sass, Blazor CSS isolation) and the main Blazor component libraries, free and open-source first (MudBlazor, Radzen, Blazorise, Fluent UI, Ant Design, HAVIT, Blazor Bootstrap, MatBlazor), commercial suites last, plus accessibility.

Localization

  • Globalization and Localization — IStringLocalizer/IViewLocalizer, .resx conventions, RequestLocalizationMiddleware and culture providers, route/query/cookie culture selection, data annotations localization, and Blazor localization.