websocket-sharp : WebSocketSharp.Net Namespace

# Cookie Class

Provides a set of properties and methods used to manage an HTTP Cookie.

## Syntax

public sealed class Cookie

## Remarks

The Cookie class supports the following cookie formats: Netscape specification, RFC 2109 and RFC 2965.

The Cookie class cannot be inherited.

## Requirements

Namespace: WebSocketSharp.Net
Assembly: websocket-sharp (in websocket-sharp.dll)

## Members

See Also: Inherited members from object.

## Public Constructors

| Cookie () | Initializes a new instance of the WebSocketSharp.Net.Cookie class.
| Cookie (string, string) | Initializes a new instance of the WebSocketSharp.Net.Cookie class with the specified name and value.
| Cookie (string, string, string) | Initializes a new instance of the WebSocketSharp.Net.Cookie class with the specified name, value and path.
| Cookie (string, string, string, string) | Initializes a new instance of the WebSocketSharp.Net.Cookie class with the specified name, value, path and domain.

## Public Properties

| Comment | string . Gets or sets the value of the Comment attribute of the cookie.
| CommentUri | Uri . Gets or sets the value of the CommentURL attribute of the cookie.
| Discard | bool . Gets or sets a value indicating whether the client discards the cookie unconditionally when the client terminates.
| Domain | string . Gets or sets the value of the Domain attribute of the cookie.
| Expired | bool . Gets or sets a value indicating whether the cookie has expired.
| Expires | DateTime . Gets or sets the value of the Expires attribute of the cookie.
| HttpOnly | bool . Gets or sets a value indicating non-HTTP APIs can access the cookie.
| Name | string . Gets or sets the Name of the cookie.
| Path | string . Gets or sets the value of the Path attribute of the cookie.
| Port | string . Gets or sets the value of the Port attribute of the cookie.
| Secure | bool . Gets or sets a value indicating whether the security level of the cookie is secure.
[read-only] | TimeStamp | DateTime . Gets the time when the cookie was issued.
| Value | string . Gets or sets the Value of the cookie.
| Version | int . Gets or sets the value of the Version attribute of the cookie.

## Public Methods

override

Equals (object) : bool

> Determines whether the specified object is equal to the current WebSocketSharp.Net.Cookie.

override

GetHashCode () : int

> Serves as a hash function for a WebSocketSharp.Net.Cookie object.

override

ToString () : string

> Returns a string that represents the current WebSocketSharp.Net.Cookie.

## Extension Methods

static

IsNull<T> (this T) : bool

> Determines whether the specified object is `null`.

static

IsNullDo<T> (this T, Action) : bool

> Determines whether the specified object is `null`. And invokes the specified Action delegate if the specified object is `null`.

## Member Details

### Cookie Constructor

> Initializes a new instance of the WebSocketSharp.Net.Cookie class.

> ## Syntax

> public Cookie ()

> ## Remarks

> Documentation for this section has not yet been entered.

> ## Requirements

> Namespace: WebSocketSharp.Net
> Assembly: websocket-sharp (in websocket-sharp.dll)

### Cookie Constructor

> Initializes a new instance of the WebSocketSharp.Net.Cookie class with the specified name and value.

> ## Syntax

> public Cookie (string name, string value)

> #### Parameters

> > name
> >   A string that contains the Name of the cookie.
> > value
> >   A string that contains the Value of the cookie.

> #### Exceptions

> > Type | Reason
> > --- | ---
> > WebSocketSharp.Net.CookieException | name is `null` or string.Empty. - or - name contains an invalid character. - or - value is `null`. - or - value contains a string not enclosed in double quotes that contains an invalid character.

> ## Remarks

> Documentation for this section has not yet been entered.

> ## Requirements

> Namespace: WebSocketSharp.Net
> Assembly: websocket-sharp (in websocket-sharp.dll)

### Cookie Constructor

> Initializes a new instance of the WebSocketSharp.Net.Cookie class with the specified name, value and path.

> ## Syntax

> public Cookie (string name, string value, string path)

> #### Parameters

> > name
> >   A string that contains the Name of the cookie.
> > value
> >   A string that contains the Value of the cookie.
> > path
> >   A string that contains the value of the Path attribute of the cookie.

> #### Exceptions

> > Type | Reason
> > --- | ---
> > WebSocketSharp.Net.CookieException | name is `null` or string.Empty. - or - name contains an invalid character. - or - value is `null`. - or - value contains a string not enclosed in double quotes that contains an invalid character.

> ## Remarks

> Documentation for this section has not yet been entered.

> ## Requirements

> Namespace: WebSocketSharp.Net
> Assembly: websocket-sharp (in websocket-sharp.dll)

### Cookie Constructor

> Initializes a new instance of the WebSocketSharp.Net.Cookie class with the specified name, value, path and domain.

> ## Syntax

> public Cookie (string name, string value, string path, string domain)

> #### Parameters

> > name
> >   A string that contains the Name of the cookie.
> > value
> >   A string that contains the Value of the cookie.
> > path
> >   A string that contains the value of the Path attribute of the cookie.
> > domain
> >   A string that contains the value of the Domain attribute of the cookie.

> #### Exceptions

> > Type | Reason
> > --- | ---
> > WebSocketSharp.Net.CookieException | name is `null` or string.Empty. - or - name contains an invalid character. - or - value is `null`. - or - value contains a string not enclosed in double quotes that contains an invalid character.

> ## Remarks

> Documentation for this section has not yet been entered.

> ## Requirements

> Namespace: WebSocketSharp.Net
> Assembly: websocket-sharp (in websocket-sharp.dll)

### Comment Property

> Gets or sets the value of the Comment attribute of the cookie.

> ## Syntax

> public string Comment { get; set; }

> #### Value

> > A string that contains a comment to document intended use of the cookie.

> ## Remarks

> Documentation for this section has not yet been entered.

> ## Requirements

> Namespace: WebSocketSharp.Net
> Assembly: websocket-sharp (in websocket-sharp.dll)

### CommentUri Property

> Gets or sets the value of the CommentURL attribute of the cookie.

> ## Syntax

> public Uri CommentUri { get; set; }

> #### Value

> > A Uri that contains a URI that provides the comment to document intended use of the cookie.

> ## Remarks

> Documentation for this section has not yet been entered.

> ## Requirements

> Namespace: WebSocketSharp.Net
> Assembly: websocket-sharp (in websocket-sharp.dll)

### Discard Property

> Gets or sets a value indicating whether the client discards the cookie unconditionally when the client terminates.

> ## Syntax

> public bool Discard { get; set; }

> #### Value

> > `true` if the client discards the cookie unconditionally when the client terminates; otherwise, `false`. The default is `false`.

> ## Remarks

> Documentation for this section has not yet been entered.

> ## Requirements

> Namespace: WebSocketSharp.Net
> Assembly: websocket-sharp (in websocket-sharp.dll)

### Domain Property

> Gets or sets the value of the Domain attribute of the cookie.

> ## Syntax

> public string Domain { get; set; }

> #### Value

> > A string that contains a URI for which the cookie is valid.

> ## Remarks

> Documentation for this section has not yet been entered.

> ## Requirements

> Namespace: WebSocketSharp.Net
> Assembly: websocket-sharp (in websocket-sharp.dll)

### Equals Method

> Determines whether the specified object is equal to the current WebSocketSharp.Net.Cookie.

> ## Syntax

> public override bool Equals (object comparand)

> #### Parameters

> > comparand
> >   An object to compare with the current WebSocketSharp.Net.Cookie.

> #### Returns

> > `true` if the specified object is equal to the current WebSocketSharp.Net.Cookie; otherwise, `false`.

> ## Remarks

> Documentation for this section has not yet been entered.

> ## Requirements

> Namespace: WebSocketSharp.Net
> Assembly: websocket-sharp (in websocket-sharp.dll)

### Expired Property

> Gets or sets a value indicating whether the cookie has expired.

> ## Syntax

> public bool Expired { get; set; }

> #### Value

> > `true` if the cookie has expired; otherwise, `false`. The default is `false`.

> ## Remarks

> Documentation for this section has not yet been entered.

> ## Requirements

> Namespace: WebSocketSharp.Net
> Assembly: websocket-sharp (in websocket-sharp.dll)

### Expires Property

> Gets or sets the value of the Expires attribute of the cookie.

> ## Syntax

> public DateTime Expires { get; set; }

> #### Value

> > A DateTime that contains the date and time at which the cookie expires. The default is DateTime.MinValue.

> ## Remarks

> Documentation for this section has not yet been entered.

> ## Requirements

> Namespace: WebSocketSharp.Net
> Assembly: websocket-sharp (in websocket-sharp.dll)

### GetHashCode Method

> Serves as a hash function for a WebSocketSharp.Net.Cookie object.

> ## Syntax

> public override int GetHashCode ()

> #### Returns

> > An int that contains a hash code for this instance.

> ## Remarks

> Documentation for this section has not yet been entered.

> ## Requirements

> Namespace: WebSocketSharp.Net
> Assembly: websocket-sharp (in websocket-sharp.dll)

### HttpOnly Property

> Gets or sets a value indicating non-HTTP APIs can access the cookie.

> ## Syntax

> public bool HttpOnly { get; set; }

> #### Value

> > `true` if non-HTTP APIs can not access the cookie; otherwise, `false`.

> ## Remarks

> Documentation for this section has not yet been entered.

> ## Requirements

> Namespace: WebSocketSharp.Net
> Assembly: websocket-sharp (in websocket-sharp.dll)

### Name Property

> Gets or sets the Name of the cookie.

> ## Syntax

> public string Name { get; set; }

> #### Value

> > A string that contains the Name of the cookie.

> #### Exceptions

> > Type | Reason
> > --- | ---
> > WebSocketSharp.Net.CookieException | The value specified for a set operation is `null` or string.Empty. - or - The value specified for a set operation contains an invalid character.

> ## Remarks

> Documentation for this section has not yet been entered.

> ## Requirements

> Namespace: WebSocketSharp.Net
> Assembly: websocket-sharp (in websocket-sharp.dll)

### Path Property

> Gets or sets the value of the Path attribute of the cookie.

> ## Syntax

> public string Path { get; set; }

> #### Value

> > A string that contains a subset of URI on the origin server to which the cookie applies.

> ## Remarks

> Documentation for this section has not yet been entered.

> ## Requirements

> Namespace: WebSocketSharp.Net
> Assembly: websocket-sharp (in websocket-sharp.dll)

### Port Property

> Gets or sets the value of the Port attribute of the cookie.

> ## Syntax

> public string Port { get; set; }

> #### Value

> > A string that contains a list of the TCP ports to which the cookie applies.

> #### Exceptions

> > Type | Reason
> > --- | ---
> > WebSocketSharp.Net.CookieException | The value specified for a set operation is not enclosed in double quotes or could not be parsed.

> ## Remarks

> Documentation for this section has not yet been entered.

> ## Requirements

> Namespace: WebSocketSharp.Net
> Assembly: websocket-sharp (in websocket-sharp.dll)

### Secure Property

> Gets or sets a value indicating whether the security level of the cookie is secure.

> ## Syntax

> public bool Secure { get; set; }

> #### Value

> > `true` if the security level of the cookie is secure; otherwise, `false`. The default is `false`.

> ## Remarks

> When this property is `true`, the cookie may be included in the HTTP request only if the request is transmitted over the HTTPS.

> ## Requirements

> Namespace: WebSocketSharp.Net
> Assembly: websocket-sharp (in websocket-sharp.dll)

### TimeStamp Property

> Gets the time when the cookie was issued.

> ## Syntax

> public DateTime TimeStamp { get; }

> #### Value

> > A DateTime that contains the time when the cookie was issued.

> ## Remarks

> Documentation for this section has not yet been entered.

> ## Requirements

> Namespace: WebSocketSharp.Net
> Assembly: websocket-sharp (in websocket-sharp.dll)

### ToString Method

> Returns a string that represents the current WebSocketSharp.Net.Cookie.

> ## Syntax

> public override string ToString ()

> #### Returns

> > A string that represents the current WebSocketSharp.Net.Cookie.

> ## Remarks

> This method returns a string to use to send an HTTP Cookie to an origin server.

> ## Requirements

> Namespace: WebSocketSharp.Net
> Assembly: websocket-sharp (in websocket-sharp.dll)

### Value Property

> Gets or sets the Value of the cookie.

> ## Syntax

> public string Value { get; set; }

> #### Value

> > A string that contains the Value of the cookie.

> #### Exceptions

> > Type | Reason
> > --- | ---
> > WebSocketSharp.Net.CookieException | The value specified for a set operation is `null`. - or - The value specified for a set operation contains a string not enclosed in double quotes that contains an invalid character.

> ## Remarks

> Documentation for this section has not yet been entered.

> ## Requirements

> Namespace: WebSocketSharp.Net
> Assembly: websocket-sharp (in websocket-sharp.dll)

### Version Property

> Gets or sets the value of the Version attribute of the cookie.

> ## Syntax

> public int Version { get; set; }

> #### Value

> > An int that contains the version of the HTTP state management to which the cookie conforms.

> #### Exceptions

> > Type | Reason
> > --- | ---
> > ArgumentOutOfRangeException | The value specified for a set operation is not allowed. The value must be 0 or 1.

> ## Remarks

> Documentation for this section has not yet been entered.

> ## Requirements

> Namespace: WebSocketSharp.Net
> Assembly: websocket-sharp (in websocket-sharp.dll)