# Cookie Management sample page

This page demonstrates basic cookie management.

## Setup

Press `ctrl+t` to open another WebView under the same WebView2 environment that navigates to https://www.bing.com.

## Creating Cookie Manager

One can start off by getting the cookie manager associated with the WebView2 by using `ICoreWebView2::get_CookieManager`.

## Getting Cookies

One can use the cookie manager to get an `ICoreWebView2CookieList` that contains the `ICoreWebView2Cookie`s that are associated with the specified URI. Try clicking the Get cookies button below. If calling `GetCookies` with an empty URI, all cookies under the same profile are returned.

Runs `ICoreWebView2CookieManager::GetCookies`.

## Adding or Updating Cookie

One can set a cookie by first creating a cookie object calling `ICoreWebView2CookieManager::CreateCookie`.

This creates an `ICoreWebView2Cookie` with `CookieName` and `CookieValue`, and then runs `ICoreWebView2CookieManager::AddOrUpdateCookie` with such `ICoreWebView2Cookie`.

## Clearing Cookies

Runs `ICoreWebView2CookieManager::DeleteAllCookies`.