Early Preview

This is currently very much a preview. Please feel free to try things out, but don't be upset if anything is not yet working. Feedback is welcome over on our GitHub Dicussions page.

class Microsoft.​AspNetCore.​Http.​CookieBuilder

Assembly: Microsoft.AspNetCore.Http.Abstractions

Inheritance: object → CookieBuilder

Defines settings used to create a cookie.

Properties

public string
Name
The name of the cookie.
public string
Path
The cookie path.
Remarks Determines the value that will be set for <see cref="P:Microsoft.AspNetCore.Http.CookieOptions.Path" /> .
public string
Domain
The domain to associate the cookie with.
Remarks Determines the value that will be set for <see cref="P:Microsoft.AspNetCore.Http.CookieOptions.Domain" /> .
public bool
HttpOnly
Indicates whether a cookie is inaccessible by client-side script. The default value is <c>false</c> but specific components may use a different value.
Remarks Determines the value that will be set on <see cref="P:Microsoft.AspNetCore.Http.CookieOptions.HttpOnly" /> .
public SameSiteMode
SameSite
The SameSite attribute of the cookie. The default value is <see cref="F:Microsoft.AspNetCore.Http.SameSiteMode.Unspecified" /> but specific components may use a different value.
Remarks Determines the value that will be set for <see cref="P:Microsoft.AspNetCore.Http.CookieOptions.SameSite" /> .
SecurePolicy
The policy that will be used to determine <see cref="P:Microsoft.AspNetCore.Http.CookieOptions.Secure" /> . This is determined from the <see cref="T:Microsoft.AspNetCore.Http.HttpContext" /> passed to <see cref="M:Microsoft.AspNetCore.Http.CookieBuilder.Build(Microsoft.AspNetCore.Http.HttpContext,System.DateTimeOffset)" /> .
Expiration
Gets or sets the lifespan of a cookie.
MaxAge
Gets or sets the max-age for the cookie.
public bool
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 <c>false</c> but specific components may use a different value.
Extensions
Gets a collection of additional values to append to the cookie.

Methods

public CookieOptions
Build​(HttpContext context)
Creates the cookie options from the given <paramref name="context" /> .
Returns The cookie options.
context The <see cref="T:Microsoft.AspNetCore.Http.HttpContext" /> .
public CookieOptions
Build​(HttpContext context, System.​DateTimeOffset expiresFrom)
Creates the cookie options from the given <paramref name="context" /> with an expiration based on <paramref name="expiresFrom" /> and <see cref="P:Microsoft.AspNetCore.Http.CookieBuilder.Expiration" /> .
Returns The cookie options.
context The <see cref="T:Microsoft.AspNetCore.Http.HttpContext" /> .
expiresFrom The time to use as the base for computing <see cref="P:Microsoft.AspNetCore.Http.CookieOptions.Expires" /> .
public bool
Equals​(object obj)
Inherited from object
protected void
Finalize​()
Inherited from object
public int
GetHashCode​()
Inherited from object
GetType​()
Inherited from object
protected object
MemberwiseClone​()
Inherited from object
public string
ToString​()
Inherited from object