简体   繁体   中英

windows phone 8.1 universal app : clear cookies

I am developing windows phone 8.1 universal app and i wish to clear cookies from browsers.

I have used windows.phone.controls namespace and used following code await new WebBrowser().ClearCookiesAsync(); but it says that it throws several error. Please help windows programmers .

I think the above code works well for silverlight app but not for universal app windows phone8.1 app. Please Help

The following should work for clearing the cookies for a specific URI:

Windows.Web.Http.Filters.HttpBaseProtocolFilter myFilter = new Windows.Web.Http.Filters.HttpBaseProtocolFilter(); 
var cookieManager = myFilter.CookieManager; 
HttpCookieCollection myCookieJar = cookieManager.GetCookies(new Uri("target URI for WebView")); 
foreach (HttpCookie cookie in myCookieJar) 
{ 
    cookieManager.DeleteCookie(cookie); 
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM