Compartir a través de


CoreWebView2CookieManager Class

Creates, adds or updates, gets, or or view the cookies. The changes would apply to the context of the user profile. That is, other WebViews under the same user profile could be affected.

Summary

Members Description
AddOrUpdateCookie Adds or updates a cookie with the given cookie data; may overwrite cookies with matching name, domain, and path if they exist.
CopyCookie Creates a cookie whose params matches those of the specified cookie.
CreateCookie Creates a cookie object with a specified name, value, domain, and path.
DeleteAllCookies Deletes all cookies under the same profile.
DeleteCookie Deletes a cookie whose name and domain/path pair match those of the specified cookie.
DeleteCookies Deletes cookies with matching name and uri.
DeleteCookiesWithDomainAndPath Deletes cookies with matching name and domain/path pair.
GetCookiesAsync Gets a list of cookies matching the specific URI.

Methods

AddOrUpdateCookie

void AddOrUpdateCookie(CoreWebView2Cookie cookie)

Adds or updates a cookie with the given cookie data; may overwrite cookies with matching name, domain, and path if they exist. This method will fail if the domain of the given cookie is not specified.

CopyCookie

CoreWebView2Cookie CopyCookie(CoreWebView2Cookie cookieParam)

Creates a cookie whose params matches those of the specified cookie.

CreateCookie

CoreWebView2Cookie CreateCookie(string name, string value, string Domain, string Path)

Creates a cookie object with a specified name, value, domain, and path. One can set other optional properties after cookie creation. This only creates a cookie object and it is not added to the cookie manager until you call CoreWebView2CookieManager.AddOrUpdateCookie. name that starts with whitespace(s) is not allowed.

DeleteAllCookies

void DeleteAllCookies()

Deletes all cookies under the same profile. This could affect other WebViews under the same user profile.

DeleteCookie

void DeleteCookie(CoreWebView2Cookie cookie)

Deletes a cookie whose name and domain/path pair match those of the specified cookie.

DeleteCookies

void DeleteCookies(string name, string uri)

Deletes cookies with matching name and uri.

DeleteCookiesWithDomainAndPath

void DeleteCookiesWithDomainAndPath(string name, string Domain, string Path)

Deletes cookies with matching name and domain/path pair.

GetCookiesAsync

IAsyncOperation<IVectorView<CoreWebView2Cookie>> GetCookiesAsync(string uri)

Gets a list of cookies matching the specific URI. You can modify the cookie objects by calling CoreWebView2CookieManager.AddOrUpdateCookie, and the changes will be applied to the webview.

Referenced by