Welcome Guest Search | Active Topics | Sign In | Register

transfer webView cookies to httpClient cookieContainer? Options
afg1
Posted: Friday, June 4, 2021 11:45:56 AM
Rank: Newbie
Groups: Member

Joined: 6/4/2021
Posts: 1
Hello. I am attempting to transfer EO.WebEngine.Cookie to a cookieContainer object that requires a System.Net.Cookie object. Seems to allow me to add the webview cookie to my cookieContainer but is this the correct approach for transferring webview cookies to an httpClient class / cookiecontainer?

Code: C#
var browserCookies = myWebView.Engine.CookieManager.GetCookies();
            for (int i = 0; i < browserCookies.Count; i++)
            {
                Cookie c = browserCookies[i];
                cookieContainer.Add(c);
            }
eo_support
Posted: Friday, June 4, 2021 3:46:57 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,217
Hi,

Yes. You can do it that way because EO.WebEngine.Cookie has an implicit conversion operator to System.Net.Cookie.

However you should NOT call GetCookies without an Url in this case. This will give you ALL the cookies the browser engine has. So your code could actually send site X's cookie to site Y. This is both a performance waste and a serious security issue.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.