|
Rank: Newbie Groups: Member
Joined: 11/4/2020 Posts: 2
|
Using EO.WebBrowser I am unable to fetch cookies as I should've been able to. Even with having IncludeHttpOnly cookies flag on to no avail.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
Hi,
Please provide more details on how you fetch the cookies and then we can go from there.
Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 11/4/2020 Posts: 2
|
eo_support wrote:Hi,
Please provide more details on how you fetch the cookies and then we can go from there.
Thanks! Quote: Dim x = EO.WebEngine.Engine.Default.CookieManager.GetCookies() Dim host_cookie = "" Dim yy As Cookie Dim c = "" MessageBox.Show(x.Count) For Each m In x
yy = x.Get(m) c += yy.Domain + " " + m + "=" + yy.Value.ToString() + vbNewLine Next MessageBox.Show(c)
This is how I fetch cookies, but unfortunately not able to grab the cookies even though fiddler shows the cookies being transmitted and are in every request.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
Hi, In that case you can try to isolate the problem into a test project and send the test project to us. See here for more details: https://www.essentialobjects.com/forum/test_project.aspxAfter we receive the test project, we will be happy to investigate further. Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 9/20/2016 Posts: 73
|
Chromium cookies are stored in the "Cookies" file by default. This file is actually a SQLite base and can be opened in any SQLite viewer. Previously, cookie values were stored in the "value" column, but in recent chrome builds this column is "<NULL>" and all values are stored in the "encrypted_val" column. So you need to decode them before using. Maybe that's the problem.
Starting Chrome 80 version, cookies are encrypted using the AES256-GCM algorithm, and the AES encryption key is encrypted with the DPAPI encryption system, and the encrypted key is stored inside the ‘Local State’ file. I also cannot get the cookies correctly from WebBrowser on chromium v81.0.4044.113, so I roll back to WebBrowser on chromium v70.0.3538.77
Is there a way to disable cookie encryption?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
rainstuff wrote:Chromium cookies are stored in the "Cookies" file by default. This file is actually a SQLite base and can be opened in any SQLite viewer. Previously, cookie values were stored in the "value" column, but in recent chrome builds this column is "<NULL>" and all values are stored in the "encrypted_val" column. So you need to decode them before using. Maybe that's the problem.
Starting Chrome 80 version, cookies are encrypted using the AES256-GCM algorithm, and the AES encryption key is encrypted with the DPAPI encryption system, and the encrypted key is stored inside the ‘Local State’ file. I also cannot get the cookies correctly from WebBrowser on chromium v81.0.4044.113, so I roll back to WebBrowser on chromium v70.0.3538.77
Is there a way to disable cookie encryption? You are not suppose to access cookie that way. We will only support methods provided by our API. We are not in a position to provide you support on how to "hack" Chromium browser engine.
|
|
Rank: Advanced Member Groups: Member
Joined: 9/20/2016 Posts: 73
|
KimmyS wrote:eo_support wrote:Hi,
Please provide more details on how you fetch the cookies and then we can go from there.
Thanks! This is how I fetch cookies, but unfortunately not able to grab the cookies even though fiddler shows the cookies being transmitted and are in every request. Hi, KimmyS! This is part of my code in C# and it works on latest version EO.Total 20.2.90:
Code: C#
EO.WebBrowser.WinForm.WebControl wc = GetCurrentWebControl();
var shost="google.com";
var cookieCollection = wc.WebView.Engine.CookieManager.GetCookies("", false);
Dictionary<string, string> cookDict = new Dictionary<string, string>();
foreach(var cc in cookieCollection.AllKeys)
{
if ((
((cookieCollection[cc].Expires < DateTime.Now) && (cookieCollection[cc].Expires.Kind == DateTimeKind.Local))||
((cookieCollection[cc].Expires < DateTime.UtcNow) && (cookieCollection[cc].Expires.Kind == DateTimeKind.Utc))
)&&
(cookieCollection[cc].Expires.Kind!=DateTimeKind.Unspecified)) continue;
if (
cookieCollection[cc].Domain.Contains("." + shost) || cookieCollection[cc].Domain.Equals(shost)
)
{
if (cookDict.ContainsKey(cc))
{
cookDict[cc] = cookieCollection[cc].Value;
}else
{
cookDict.Add(cc, cookieCollection[cc].Value);
}
}
}
var cooks=cookDict.ToCookieString();
ToCookieString() is an extension:
Code: C#
static class ControlExtensions
{
public static string ToCookieString<TKey, TValue>(this IDictionary<TKey, TValue> dictionary)
{
return string.Join(Environment.NewLine, dictionary.Select(kv => kv.Key + "=" + kv.Value).ToArray());
}
}
P.S. I found a way to encrypt/decrypt cookies directly in Cookies file on Chromium v80 and later, so the problem is solved:)
|
|