# HttpCookieCollection

Namespace: **Wisej.Core**

Assembly: **Wisej.Framework** (4.0.0.0)

Encapsulates the cookies sent in an HTTP request.

{% tabs %}
{% tab title="C#" %}

```csharp
public class HttpCookieCollection
```

{% endtab %}

{% tab title="VB.NET" %}

```visual-basic
Public Class HttpCookieCollection
```

{% endtab %}
{% endtabs %}

## Properties

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) AllKeys

[String\[\]](https://docs.microsoft.com/dotnet/api/system.string): Returns all the keys (cookie names) in the cookie collection.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) Count

[Int32](https://docs.microsoft.com/dotnet/api/system.int32): Returns the number of cookies in the collection.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) Item(name)

[HttpCookie](https://docs.wisej.com/api/wisej.core/general/httpcookie): Returns the cookie with the specified name from the cookie collection.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) Item(index)

[HttpCookie](https://docs.wisej.com/api/wisej.core/general/httpcookie): Returns the cookie with the specified numerical index from the cookie collection.

## Methods

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) Add(cookie)

Adds the specified cookie to the cookie collection.

| Parameter  | Type                                                                   | Description |
| ---------- | ---------------------------------------------------------------------- | ----------- |
| **cookie** | [HttpCookie](https://docs.wisej.com/api/wisej.core/general/httpcookie) |             |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) Clear()

Clears all cookies from the cookie collection.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) Get(name)

Returns the cookie with the specified name from the cookie collection.

| Parameter | Type                                                          | Description                     |
| --------- | ------------------------------------------------------------- | ------------------------------- |
| **name**  | [String](https://docs.microsoft.com/dotnet/api/system.string) | Name of the cookie to retrieve. |

**Returns:** [HttpCookie](https://docs.wisej.com/api/wisej.core/general/httpcookie).

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) Get(index)

Returns the [HttpCookie](https://docs.wisej.com/api/wisej.core/general/httpcookie) at the specified index.

| Parameter | Type                                                        | Description                      |
| --------- | ----------------------------------------------------------- | -------------------------------- |
| **index** | [Int32](https://docs.microsoft.com/dotnet/api/system.int32) | Index of the cookie to retrieve. |

**Returns:** [HttpCookie](https://docs.wisej.com/api/wisej.core/general/httpcookie).

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) GetKey(index)

Returns the key (name) of the cookie at the specified numerical index.

| Parameter | Type                                                        | Description |
| --------- | ----------------------------------------------------------- | ----------- |
| **index** | [Int32](https://docs.microsoft.com/dotnet/api/system.int32) |             |

**Returns:** [String](https://docs.microsoft.com/dotnet/api/system.string).

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) Remove(name)

Removes the cookie with the specified name from the collection.

| Parameter | Type                                                          | Description |
| --------- | ------------------------------------------------------------- | ----------- |
| **name**  | [String](https://docs.microsoft.com/dotnet/api/system.string) |             |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) Set(cookie)

Updates the value of an existing cookie in a cookie collection.

| Parameter  | Type                                                                   | Description |
| ---------- | ---------------------------------------------------------------------- | ----------- |
| **cookie** | [HttpCookie](https://docs.wisej.com/api/wisej.core/general/httpcookie) |             |
