CookieOptions Class
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Options used to create a new cookie.
public ref class CookieOptions
public class CookieOptions
type CookieOptions = class
Public Class CookieOptions
- Inheritance
-
CookieOptions
A CookieOptions instance is intended to govern the behavior of an individual cookie. Reusing the same CookieOptions instance across multiple cookies can lead to unintended consequences, such as modifications affecting multiple cookies. We recommend instantiating a new CookieOptions object for each cookie to ensure that the configuration is applied independently.
Cookie |
Creates a default cookie with a path of '/'. |
Cookie |
Creates a copy of the given CookieOptions. |
Domain |
Gets or sets the domain to associate the cookie with. |
Expires |
Gets or sets the expiration date and time for the cookie. |
Extensions |
Gets a collection of additional values to append to the cookie. |
Http |
Gets or sets a value that indicates whether a cookie is inaccessible by client-side script. |
Is |
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. |
Max |
Gets or sets the max-age for the cookie. |
Path |
Gets or sets the cookie path. |
Same |
Gets or sets the value for the SameSite attribute of the cookie. The default value is Unspecified |
Secure |
Gets or sets a value that indicates whether to transmit the cookie using Secure Sockets Layer (SSL)--that is, over HTTPS only. |
Create |
Creates a SetCookieHeaderValue using the current options. |
Product | Versions |
---|---|
ASP.NET Core | 1.0, 1.1, 2.0, 2.1, 2.2, 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0 |