Method SetCookie
SetCookie(Cookie)
Sets a cookie and sends it in the response to be set by the client.
public void SetCookie(Cookie cookie)
Parameters
cookie
CookieThe cookie object.
SetCookie(string, string)
Sets a cookie and sends it in the response to be set by the client.
public void SetCookie(string name, string value)
Parameters
SetCookie(string, string, DateTime?, TimeSpan?, string?, string?, bool?, bool?, string?)
Sets a cookie and sends it in the response to be set by the client.
public void SetCookie(string name, string value, DateTime? expires = null, TimeSpan? maxAge = null, string? domain = null, string? path = null, bool? secure = null, bool? httpOnly = null, string? sameSite = null)
Parameters
name
stringThe cookie name.
value
stringThe cookie value.
expires
DateTime?The cookie expirity date.
maxAge
TimeSpan?The cookie max duration after being set.
domain
stringThe domain where the cookie will be valid.
path
stringThe path where the cookie will be valid.
secure
bool?Determines if the cookie will only be stored in an secure context.
httpOnly
bool?Determines if the cookie will be only available in the HTTP context.
sameSite
stringThe cookie SameSite parameter.