Meziantou.AspNetCore.Components.WebAssembly
2.1.6
Prefix Reserved
dotnet add package Meziantou.AspNetCore.Components.WebAssembly --version 2.1.6
NuGet\Install-Package Meziantou.AspNetCore.Components.WebAssembly -Version 2.1.6
<PackageReference Include="Meziantou.AspNetCore.Components.WebAssembly" Version="2.1.6" />
<PackageVersion Include="Meziantou.AspNetCore.Components.WebAssembly" Version="2.1.6" />
<PackageReference Include="Meziantou.AspNetCore.Components.WebAssembly" />
paket add Meziantou.AspNetCore.Components.WebAssembly --version 2.1.6
#r "nuget: Meziantou.AspNetCore.Components.WebAssembly, 2.1.6"
#:package Meziantou.AspNetCore.Components.WebAssembly@2.1.6
#addin nuget:?package=Meziantou.AspNetCore.Components.WebAssembly&version=2.1.6
#tool nuget:?package=Meziantou.AspNetCore.Components.WebAssembly&version=2.1.6
Meziantou.AspNetCore.Components.WebAssembly
A .NET library providing services and utilities for Blazor WebAssembly applications.
Features
DefaultBrowserOptionsMessageHandler
A message handler that allows you to set default browser options for all HTTP requests in your Blazor WebAssembly application. This is particularly useful for controlling browser cache behavior, credentials, and request modes.
Usage
Register the handler with HttpClient using dependency injection. DefaultBrowserOptionsMessageHandler is in the
Meziantou.AspNetCore.Components.WebAssembly namespace, and BrowserRequestCache in
Microsoft.AspNetCore.Components.WebAssembly.Http:
var builder = WebAssemblyHostBuilder.CreateDefault(args);
// Add HttpClient with default browser options
builder.Services.AddHttpClient<MyApiClient>()
.ConfigureHttpClient(client => client.BaseAddress = new Uri(builder.HostEnvironment.BaseAddress))
.AddHttpMessageHandler(() => new DefaultBrowserOptionsMessageHandler()
{
DefaultBrowserRequestCache = BrowserRequestCache.NoCache
});
await builder.Build().RunAsync();
Behavior
Only the options you set on the handler are applied. An option you leave unset is not sent to the
browser, so the Fetch defaults keep applying
(cache: "default", credentials: "same-origin", mode: "cors"). In the example above, only the
cache option is set; credentials and mode are untouched.
Options already set on an individual request always win over the handler defaults:
// This request keeps force-cache, whatever the handler is configured with
request.SetBrowserRequestCache(BrowserRequestCache.ForceCache);
Before version 2.1.0, unset properties were sent using their default enum value, which meant
credentials: "omit" and mode: "same-origin" were applied even when only the cache was configured.
That broke cookie-based authentication and cross-origin requests. If you relied on that behavior, set
DefaultBrowserRequestCredentials and DefaultBrowserRequestMode explicitly.
Additional Resources
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. net11.0 is compatible. |
-
net10.0
- Microsoft.AspNetCore.Components.Web (>= 10.0.13)
- Microsoft.AspNetCore.Components.WebAssembly (>= 10.0.13)
-
net11.0
- Microsoft.AspNetCore.Components.Web (>= 11.0.0-rc.3.26522.148)
- Microsoft.AspNetCore.Components.WebAssembly (>= 11.0.0-rc.3.26522.148)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.1.6 | 0 | 11/8/2026 |
| 2.1.5 | 140 | 10/28/2026 |
| 2.1.4 | 86 | 10/21/2026 |
| 2.1.3 | 79 | 10/16/2026 |
| 2.1.2 | 218 | 9/11/2026 |
| 2.1.1 | 177 | 9/6/2026 |
| 2.1.0 | 109 | 9/4/2026 |
| 2.0.4 | 119 | 8/29/2026 |
| 2.0.3 | 155 | 8/16/2026 |
| 2.0.2 | 122 | 8/9/2026 |
| 2.0.1 | 336 | 7/17/2026 |
| 2.0.0 | 140 | 7/5/2026 |
| 1.0.29 | 128 | 6/28/2026 |
| 1.0.28 | 139 | 6/13/2026 |
| 1.0.27 | 109 | 6/13/2026 |
| 1.0.26 | 143 | 5/31/2026 |
| 1.0.25 | 197 | 5/14/2026 |
| 1.0.24 | 236 | 4/25/2026 |
| 1.0.23 | 175 | 3/29/2026 |
| 1.0.22 | 174 | 3/15/2026 |