Skip to main content
Version: 3.5

CookieCollection

Namespace: Wisej.Base

Assembly: Wisej.Framework (3.5.0.0)

Manages the collection of cookies for the current application.

public class CookieCollection : IList<Cookie>, ICollection<Cookie>, IEnumerable<Cookie>, IEnumerable

Properties

Instance memberCount

Int32: Returns the number of Cookie items in the collection.

Instance memberItem(name)

String: Returns the Cookie with a specific name from a CookieCollection.

Throws:

Instance memberItem(index)

Cookie: Returns the Cookie with a specific name from a CookieCollection.

Throws:

Methods

Adds a cookie to the collection.

ParameterTypeDescription
cookieCookieThe cookie to add.

Instance memberAdd(name, value)

Adds a new cookie to the collection.

ParameterTypeDescription
nameStringThe case-sensitive name of the cookie.
valueStringThe value of the new cookie to add.

Returns: Cookie.

Instance memberAdd(name, value, domain)

Adds a new cookie to the collection.

ParameterTypeDescription
nameStringThe case-sensitive name of the cookie.
valueStringThe value of the new cookie to add.
domainStringThe domain, or partial domain, associated with the cookie.

Returns: Cookie.

Instance memberAdd(name, value, expires)

Adds a new cookie to the collection.

ParameterTypeDescription
nameStringThe case-sensitive name of the cookie.
valueStringThe value of the new cookie.
expiresDateTimeThe expiration date/time of the new cookie.

Returns: Cookie.

Instance memberAdd(name, value, domain, expires)

Adds a new cookie to the collection.

ParameterTypeDescription
nameStringThe case-sensitive name of the cookie.
valueStringThe value of the new cookie.
domainStringThe value of the new cookie.
expiresDateTimeThe expiration date/time of the new cookie.

Returns: Cookie.

Instance memberClear()

Delete all cookies from the collection. NOTE: Cookies are only removed from the collection, not from the client. You need to set the expiration date to remove it from the client.

Determines whether the cookie is present in the collection.

ParameterTypeDescription
cookieCookieThe cookie to locate.

Returns: Boolean.

Instance memberCopyTo(array, index)

Copies the cookie collection to a compatible one-dimensional array, starting at the specified index of the target array.

ParameterTypeDescription
arrayCookie[]The one-dimensional System.Array that is the destination of the elements copied.
indexInt32The zero-based index in array at which copying begins.

Instance memberGet(name)

Returns the cookie with the specified name.

ParameterTypeDescription
nameStringThe case-sensitive name of the cookie to locate.

Returns: Cookie.

Instance memberGetEnumerator()

Returns: IEnumerator<Cookie>.

Searches for the specified cookie and returns the zero-based index of the first occurrence.

ParameterTypeDescription
cookieCookieThe cookie to locate.

Returns: Int32.

Instance memberIndexOf(name)

Searches for the specified cookie by name and returns the zero-based index of the first occurrence.

ParameterTypeDescription
nameStringThe case-sensitive name cookie to locate.

Returns: Int32.

Removes the specified cookie from the collection. NOTE: Cookies are only removed from the collection, not from the client. You need to set the expiration date to remove it from the client.

ParameterTypeDescription
cookieCookieThe cookie to remove from the collection.

Returns: Boolean. true if item is successfully removed; otherwise, false.

Instance memberRemove(name)

Removes the specified cookie from the collection. NOTE: Cookies are only removed from the collection, not from the client. You need to set the expiration date to remove it from the client.

ParameterTypeDescription
nameStringThe case-sensitive name of the cookie to remove from the collection.

Returns: Boolean. true if item is successfully removed; otherwise, false.

Instance memberRemoveAt(index)

Removes the cookie at the specified index. NOTE: Cookies are only removed from the collection, not from the client. You need to set the expiration date to remove it from the client.

ParameterTypeDescription
indexInt32The zero-based index of the element to remove.