Welcome Guest Search | Active Topics | Sign In | Register

Problems with setting cookies Options
Sören
Posted: Thursday, July 2, 2020 9:50:48 AM
Rank: Member
Groups: Member

Joined: 5/14/2020
Posts: 19
I have a problem with setting cookies.
The method WebView.Engine.CookieManager.SetCookie() simply does not return. It only happens the second time this method is called. The whole application does not repond anymore but no error is thrown.
Sören
Posted: Thursday, July 2, 2020 11:37:31 AM
Rank: Member
Groups: Member

Joined: 5/14/2020
Posts: 19
I have tried to work around the problem by first checking with the GetCookies method whether the cookie I want to set already exists. Unfortunately the method GetCookies does not return the second time I call it.
eo_support
Posted: Thursday, July 2, 2020 12:47:05 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,070
Which version do you use?
Sören
Posted: Friday, July 3, 2020 5:08:21 AM
Rank: Member
Groups: Member

Joined: 5/14/2020
Posts: 19
20.1.88
eo_support
Posted: Saturday, July 4, 2020 2:53:14 PM
Rank: Administration
Groups: Administration

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

Please make sure you DO NOT call SetCookie from your main UI thread. Calling SetCookie from your main UI thread will cause it to hang. For example, if you handle a Button's Click event and you have the following code:

Code: C#
private void Button1_Click(object sender, EventArgs e)
{
    webView.Engine.CookieManager.SetCookie(....);
}


Then SetCookie will hang because it is called by Button1_Click event handler, which is called by your main UI thread. To avoid this problem, call the code in a thread pool thread:

Code: C#
private void Button1_Click(object sender, EventArgs e)
{
    System.Threading.ThreadPool.QueueUserWorkItem((arg) =>
    {
        webView.Engine.CookieManager.SetCookie(....);
    }, null);
}


Please let us know if this works for you.

Thanks!
eo_support
Posted: Monday, July 27, 2020 3:25:40 PM
Rank: Administration
Groups: Administration

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

This is just to let you know that we have posted a new build that no longer requires you to call SetCookie in a background thread. You can download the new build from our download page.

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.