Soenneker.Blazor.Utils.Cookies
4.0.72
Prefix Reserved
dotnet add package Soenneker.Blazor.Utils.Cookies --version 4.0.72
NuGet\Install-Package Soenneker.Blazor.Utils.Cookies -Version 4.0.72
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Soenneker.Blazor.Utils.Cookies" Version="4.0.72" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Blazor.Utils.Cookies" Version="4.0.72" />
<PackageReference Include="Soenneker.Blazor.Utils.Cookies" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Soenneker.Blazor.Utils.Cookies --version 4.0.72
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Soenneker.Blazor.Utils.Cookies, 4.0.72"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Soenneker.Blazor.Utils.Cookies@4.0.72
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Soenneker.Blazor.Utils.Cookies&version=4.0.72
#tool nuget:?package=Soenneker.Blazor.Utils.Cookies&version=4.0.72
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Soenneker.Blazor.Utils.Cookies
Blazor library for reading, writing, removing, and listing browser cookies. Exposes a low-level ICookiesInterop for direct browser interop and a higher-level ICookiesUtil for app-facing usage.
Install
dotnet add package Soenneker.Blazor.Utils.Cookies
Setup
Register cookie services in Program.cs:
builder.Services.AddCookiesUtilAsScoped();
Inject the higher-level utility in components/services:
@inject ICookiesUtil Cookies
Usage
Get a cookie
string? theme = await Cookies.Get("theme");
Try get a cookie
CookieGetResult result = await Cookies.TryGet("theme");
if (result.Found)
{
Console.WriteLine(result.Value);
}
Set a cookie
await Cookies.Set("theme", "dark", new CookieOptions
{
Path = "/",
MaxAge = TimeSpan.FromDays(30),
Secure = true,
SameSite = CookieSameSite.Lax
});
Remove a cookie
await Cookies.Remove("theme");
Read all cookies
IReadOnlyDictionary<string, string> cookies = await Cookies.GetAll();
foreach ((string key, string value) in cookies)
{
Console.WriteLine($"{key}={value}");
}
| 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- Soenneker.Blazor.Utils.ModuleImport (>= 4.0.1848)
- Soenneker.Extensions.String (>= 4.0.713)
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 |
|---|---|---|
| 4.0.72 | 34 | 7/30/2026 |
| 4.0.71 | 38 | 7/29/2026 |
| 4.0.70 | 33 | 7/29/2026 |
| 4.0.69 | 36 | 7/29/2026 |
| 4.0.68 | 83 | 7/27/2026 |
| 4.0.67 | 87 | 7/21/2026 |
| 4.0.66 | 93 | 7/20/2026 |
| 4.0.65 | 95 | 7/19/2026 |
| 4.0.64 | 88 | 7/18/2026 |
| 4.0.63 | 95 | 7/18/2026 |
| 4.0.62 | 87 | 7/17/2026 |
| 4.0.61 | 89 | 7/17/2026 |
| 4.0.60 | 100 | 7/17/2026 |
| 4.0.59 | 90 | 7/16/2026 |
| 4.0.58 | 86 | 7/16/2026 |
| 4.0.56 | 108 | 7/15/2026 |
| 4.0.55 | 97 | 7/15/2026 |
| 4.0.54 | 96 | 7/4/2026 |
| 4.0.53 | 100 | 7/3/2026 |
| 4.0.52 | 110 | 6/20/2026 |
Loading failed