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 ICoreWebView2Cookies 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.


Adding or Updating Cookie

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


Clearing Cookies