Class

WebCookieManager


Description

Used to get and set cookies connected with the app.

You can only get an instance of this object via the WebSession.Cookies property.

Methods

Name

Parameters

Returns

Shared

Count

Integer

NameAt

index As Integer

String

Remove

Name As String, Domain As String = "", Path As String = ""

String

Set

Name As String, Expiration As DateTime = Nil, Domain As String = "", Path As String = "", Secure As Boolean = False, HTTPOnly As Boolean = False, SameSiteStrength As WebCookieManager.SameSiteStrengths = WebCookieManager.SameSiteStrengths.Off

Value

Name As String

String

Enumerations

WebCookieManager.SameSiteStrengths

SameSiteStrengths

The site strengths available.

Enum

Description

Lax

If a get request is made to another site by the embedded script/webpage, the app's cookies will be sent.

Off

Cookies will only be sent to servers the browser accesses.

Strict

Cookies will only be sent to the domain in which the app is hosted.

Method descriptions


WebCookieManager.Count

Count As Integer

Returns the number of cookies created by the app.


WebCookieManager.NameAt

NameAt(index As Integer) As String

Returns the name of the cookie at the index passed.


WebCookieManager.Remove

Remove(Name As String, Domain As String = "", Path As String = "") As String

Removes the cookie with the Name, Domain and Path passed.


WebCookieManager.Set

Set(Name As String, Value As String, Expiration As DateTime = Nil, Domain As String = "", Path As String = "", Secure As Boolean = False, HTTPOnly As Boolean = False, SameSiteStrength As WebCookieManager.SameSiteStrengths = WebCookieManager.SameSiteStrengths.Off)

Sets the cookie to the values passed.

Parameter

Description

Name

Name of the cookie to set so you can retrieve the value later with the Value method.

Value

A value to store on the user’s browser.

Expiration

Date after which the cookie will no longer be available.

Domain

Limits access to the cookie to the domain specified.

Path

Limits access to the cookie to the path specified.

Secure

If True, the cookie can only be accessed via secure (https) connections.

HTTPOnly

If True, the cookie can only be accessed via (https) connections.

SameSiteStrength

Defines the context in which the cookies are sent by the browser to the server. The default value None means cookies are sent in all contexts. With Lax, cookies are not sent on normal cross-site subrequests (images or frames to a 3rd party site). With Strict cookies are only sent to your server.

If you don't provide an expiration date, your cookie will expire when the session ends. If you do provide an expiration date, the cookie will expire as late as the provided expiration date because browsers can decide to discard cookies before they expire.


WebCookieManager.Value

Value(Name As String) As String

Returns the cookie whose name was passed.

Notes

Session cookies are deleted by the browser when the browser decides that the session has ended.

Compatibility

Web projects on all supported operating systems.

See also

Object parent class; WebSession.Cookies property.