CookieBuilder CookieBuilder CookieBuilder CookieBuilder Class


Defines settings used to create a cookie.

public ref class CookieBuilder
public class CookieBuilder
type CookieBuilder = class
Public Class CookieBuilder


CookieBuilder() CookieBuilder() CookieBuilder() CookieBuilder()


Domain Domain Domain Domain

The domain to associate the cookie with.

Expiration Expiration Expiration Expiration

Gets or sets the lifespan of a cookie.

HttpOnly HttpOnly HttpOnly HttpOnly

Indicates whether a cookie is accessible by client-side script.

IsEssential IsEssential IsEssential IsEssential

Indicates if this cookie is essential for the application to function correctly. If true then consent policy checks may be bypassed. The default value is false.

MaxAge MaxAge MaxAge MaxAge

Gets or sets the max-age for the cookie.

Name Name Name Name

The name of the cookie.

Path Path Path Path

The cookie path.

SameSite SameSite SameSite SameSite

The SameSite attribute of the cookie. The default value is Unspecified

SecurePolicy SecurePolicy SecurePolicy SecurePolicy

The policy that will be used to determine . This is determined from the HttpContext passed to Build(HttpContext, DateTimeOffset).


Build(HttpContext) Build(HttpContext) Build(HttpContext) Build(HttpContext)

Creates the cookie options from the given context.

Build(HttpContext, DateTimeOffset) Build(HttpContext, DateTimeOffset) Build(HttpContext, DateTimeOffset) Build(HttpContext, DateTimeOffset)

Creates the cookie options from the given context with an expiration based on expiresFrom and Expiration.

Applies to