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.​CookieOptions
Assembly: Microsoft.AspNetCore.Http.Features
Inheritance: object → CookieOptions
Options used to create a new cookie.
Remarks
A <see cref="T:Microsoft.AspNetCore.Http.CookieOptions" /> instance is intended to govern the behavior of an individual cookie.
Reusing the same <see cref="T:Microsoft.AspNetCore.Http.CookieOptions" /> instance across multiple cookies can lead to unintended
consequences, such as modifications affecting multiple cookies. We recommend instantiating a new
<see cref="T:Microsoft.AspNetCore.Http.CookieOptions" /> object for each cookie to ensure that the configuration is applied
independently.
Properties
public
string
Domain
Gets or sets the domain to associate the cookie with.
public
string
Path
Gets or sets the cookie path.
Expires
Gets or sets the expiration date and time for the cookie.
public
bool
Secure
Gets or sets a value that indicates whether to transmit the cookie using Secure Sockets Layer (SSL)--that is, over HTTPS only.
public
SameSiteMode
SameSite
Gets or sets the value for the SameSite attribute of the cookie. The default value is <see cref="F:Microsoft.AspNetCore.Http.SameSiteMode.Unspecified" />
public
bool
HttpOnly
Gets or sets a value that indicates whether a cookie is inaccessible by client-side script.
public
System.​TimeSpan?
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 false.
public
System.​Collections.​Generic.​IList<​string>
Extensions
Gets a collection of additional values to append to the cookie.
Methods
CreateCookieHeader​(string name,
string value)
Creates a <see cref="T:Microsoft.Net.Http.Headers.SetCookieHeaderValue" /> using the current options.
public
bool
Equals​(object obj)
Inherited from object
protected
void
Finalize​()
Inherited from object
public
int
GetHashCode​()
Inherited from object
protected
object
MemberwiseClone​()
Inherited from object
public
string
ToString​()
Inherited from object