# 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

### ![](/files/hsR4ok3152WyAf8J2C1u) AllKeys

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

### ![](/files/hsR4ok3152WyAf8J2C1u) Count

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

### ![](/files/hsR4ok3152WyAf8J2C1u) Item(name)

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

### ![](/files/hsR4ok3152WyAf8J2C1u) Item(index)

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

## Methods

### ![](/files/hsR4ok3152WyAf8J2C1u) Add(cookie)

Adds the specified cookie to the cookie collection.

| Parameter  | Type                                                | Description |
| ---------- | --------------------------------------------------- | ----------- |
| **cookie** | [HttpCookie](/api/wisej.core/general/httpcookie.md) |             |

### ![](/files/hsR4ok3152WyAf8J2C1u) Clear()

Clears all cookies from the cookie collection.

### ![](/files/hsR4ok3152WyAf8J2C1u) 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](/api/wisej.core/general/httpcookie.md).

### ![](/files/hsR4ok3152WyAf8J2C1u) Get(index)

Returns the [HttpCookie](/api/wisej.core/general/httpcookie.md) 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](/api/wisej.core/general/httpcookie.md).

### ![](/files/hsR4ok3152WyAf8J2C1u) 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).

### ![](/files/hsR4ok3152WyAf8J2C1u) 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) |             |

### ![](/files/hsR4ok3152WyAf8J2C1u) Set(cookie)

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

| Parameter  | Type                                                | Description |
| ---------- | --------------------------------------------------- | ----------- |
| **cookie** | [HttpCookie](/api/wisej.core/general/httpcookie.md) |             |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wisej.com/api/wisej.core/general/wisej.core.httpcookiecollection.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
