AdvantageCMS.Core.Common.BaseClasses Namespace
Advantage CSP

CookieHelper..::..StoreInCookie Method (HttpContext, String, Dictionary<(Of <(<'String, String>)>)>, String, String, Nullable<(Of <(<'DateTime>)>)>, Nullable<(Of <(<'Boolean>)>)>, SameSiteMode, Boolean)

Stores multiple values in a Cookie using a key-value dictionary, creating the cookie (and/or the key) if it doesn't exists yet.

Namespace:  AdvantageCMS.Core.Utils
Assembly:  AdvantageCMS.Core (in AdvantageCMS.Core.dll)

Syntax


public static void StoreInCookie(
	HttpContext context,
	string cookieName,
	Dictionary<string, string> keyValueDictionary,
	string cookieDomain,
	string cookiePath,
	Nullable<DateTime> expirationDate,
	Nullable<bool> httpOnly,
	SameSiteMode sameSite,
	bool secure
)

Parameters

context
Type: HttpContext
The context.
cookieName
Type: String
Cookie name
keyValueDictionary
Type: Dictionary<(Of <(<'String, String>)>)>
The key value dictionary.
cookieDomain
Type: String
Cookie domain (or NULL to use default domain value)
cookiePath
Type: String
The cookie path.
expirationDate
Type: Nullable<(Of <(<'DateTime>)>)>
Expiration Date (set it to NULL to leave default expiration date)
httpOnly
Type: Nullable<(Of <(<'Boolean>)>)>
set it to TRUE to enable HttpOnly, FALSE otherwise (default: false)
sameSite
Type: SameSiteMode
set it to 'None', 'Lax', 'Strict' or '(-1)' to not add it (default: '(-1)').
secure
Type: Boolean
set it to TRUE to enable Secure (HTTPS only), FALSE otherwise