Share via


CookieBuilder Class

Definition

Defines settings used to create a cookie.

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

Constructors

CookieBuilder()

Properties

Domain

The domain to associate the cookie with.

Expiration

Gets or sets the lifespan of a cookie.

Extensions

Gets a collection of additional values to append to the cookie.

HttpOnly

Indicates whether a cookie is inaccessible by client-side script. The default value is false but specific components may use a different value.

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 but specific components may use a different value.

MaxAge

Gets or sets the max-age for the cookie.

Name

The name of the cookie.

Path

The cookie path.

SameSite

The SameSite attribute of the cookie. The default value is Unspecified but specific components may use a different value.

SecurePolicy

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

Methods

Build(HttpContext, DateTimeOffset)

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

Build(HttpContext)

Creates the cookie options from the given context.

Applies to