Skip to content

Latest commit

 

History

History
40 lines (29 loc) · 765 Bytes

File metadata and controls

40 lines (29 loc) · 765 Bytes

AltairCA.Blazor.WebAssembly.Cookie

AltairCA.Blazor.WebAssembly.Cookie is a Cookie manager for blazor webassembly.

setup

NuGet install:

Install-Package AltairCA.Blazor.WebAssembly.Cookie

Program.cs

builder.Services.AddAltairCACookieService(options =>
{
    options.DefaultExpire = TimeSpan.FromMinutes(15);
});

Example of use

Inject Service

@inject IAltairCABlazorCookieUtil _cookieUtil;

Basic Usage Example 1

await _cookieUtil.SetValueAsync("cookieName", "value");

Basic Usage Example 2

await _cookieUtil.SetValueAsync("a", "a",path:"/",domain:"localhost",secure:true);

Basic Usage Example 3

await _cookieUtil.SetValueAsync(key: "b", value: "a",span:TimeSpan.Zero);