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);
}
|
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!
|