In Blazor Server, a 'Scoped' service lifetime maps to one circuit (one user's session), so a scoped service is effectively per-user, similar to per-HTTP-request scoping in typical ASP.NET Core but lasting the whole connected session. In Blazor WebAssembly, since the entire app runs in one browser tab as a single client-side process, Scoped and Singleton are effectively equivalent -- there's only ever one 'scope' for the whole WASM app instance, since there's no server-side per-request/per-circuit boundary.
// Blazor Server: Scoped = per-user circuit
builder.Services.AddScoped<ShoppingCartState>(); // isolated per connected user
// Blazor WebAssembly: Scoped behaves like Singleton (one process per tab)
builder.Services.AddScoped<ShoppingCartState>(); // effectively one instance for the whole app
Real-world example
A shopping cart state service registered as Scoped correctly isolates each user's cart in Blazor Server (one instance per circuit) but would behave identically to a Singleton if the same app were instead deployed as Blazor WebAssembly.
Likely follow-ups
What happens if you mistakenly register a service as Singleton in Blazor Server expecting per-user isolation?
How does this affect testing services across both hosting models?
The @page directive at the top of a component marks it as a routable page, associating it with a specific URL template; Blazor's Router component (registered in App.razor) scans the application's assemblies for all @page-decorated components at startup and matches incoming navigation requests to the appropriate component, similar conceptually to ASP.NET Core MVC routing but resolved entirely client-side (or via SignalR-relayed navigation events in Server mode).
@page "/products/{id:int}"
<h3>Product @Id</h3>
@code {
[Parameter] public int Id { get; set; }
}
Real-world example
A product-detail page uses a route parameter constraint {id:int} so navigating to /products/abc (non-numeric) doesn't match this component at all, falling through to a NotFound page instead.
Likely follow-ups
How do you define a catch-all route parameter?
How does NavigationManager differ from anchor tags for programmatic navigation?
RESTful Web APIs & ControllersASP.NET Core Middleware & Request Pipeline
Prerendering renders a component's initial HTML output on the server (without full interactivity yet) and sends it as part of the initial HTTP response, so users see meaningful content immediately instead of a blank page while the Blazor runtime (SignalR connection or WASM download) initializes -- once the client-side runtime is ready, Blazor 'hydrates' the prerendered markup into a fully interactive component, ideally without a visible flash or layout shift.
// .NET 8 unified model: prerendering configured via render mode parameters
@rendermode @(new InteractiveServerRenderMode(prerender: true))
// Or globally for WebAssembly
@rendermode @(new InteractiveWebAssemblyRenderMode(prerender: true))
Real-world example
A public-facing Blazor WebAssembly app enables prerendering so search engine crawlers and users on slow connections see fully rendered initial content immediately, rather than a blank page during the multi-second WASM runtime download.
Likely follow-ups
What issues can arise if component code isn't idempotent-safe for running twice (prerender + real render)?
How does prerendering affect SEO for Blazor WebAssembly apps?
Blazor WebAssembly requires downloading the .NET runtime and app assemblies (historically several MB, though significantly reduced by trimming, AOT compilation, and runtime relinking in recent versions) before the app becomes interactive, giving it a slower 'time to interactive' on first visit compared to Blazor Server's near-instant SignalR-based startup -- mitigations include enabling trimming, lazy-loading assemblies for rarely-used features, and browser caching so repeat visits skip re-downloading.
A Blazor WebAssembly app lazy-loads its rarely-used admin module assembly only when an admin user actually navigates to admin pages, reducing the initial download size for the much larger population of regular users.
Likely follow-ups
What's the trade-off between AOT compilation's execution speed and its larger download size?
How does browser caching (via Cache-Control) help repeat visitors?
A child component exposes public properties decorated with [Parameter], and a parent component sets them as attributes when using the child component in markup, similar conceptually to passing props in other component-based UI frameworks -- Blazor automatically re-renders the child whenever a bound parameter value changes.
A reusable ProductCard component accepts a Product parameter from its parent product-list page, rendering consistent card markup for each item without duplicating layout code across every page that displays products.
Likely follow-ups
How do you pass a callback from child back to parent using EventCallback?
What happens if a parameter value is mutated directly instead of reassigned?