An newbie question: After setting Cookies through CEF.SetCookie() it is not set still

1,610 views
Skip to first unread message

Artem Golubev

unread,
Jan 18, 2013, 9:15:48 PM1/18/13
to cefs...@googlegroups.com
I'm sorry, I'm a newbie to .NET and CefSharp. In general it loads page great, but I can't figure out how to work with cookies. I use 0.12 version of CefSharp.
I'm setting cookies manually in my application, but server doesn't see them, is there some kind of bug out there or I miss something?
I set them before loading URL after I got Initialized event like this:
                            CEF.SetCookie(@"http://localhost:8080/CookiesShow/", @"localhost:8080", Name, Value, @"/CookiesShow", false, false, false, Expires);
I can see in the debug that cookies are being set, however my webserver does not receive them.
Did I miss something basic?

Jack O'Connor

unread,
Jan 20, 2013, 3:21:19 PM1/20/13
to cefs...@googlegroups.com
Sorry for being slow to follow up here. I played briefly with cookies, and the main thing I remember is that it's pretty hard to get the parameters right. There is an overloaded SetCookie method, which takes fewer parameters and has some common defaults. Any chance that one works for you? My only other suggestion is to see if you can hack your cookie in using javascript. That would help rule out the possibility that your server has some cookie settings that are hurting you. (That actually happened to me once. The server I was working with had a cookies whitelist :p)


--
You received this message because you are subscribed to the Google Groups "CefSharp" group.
To view this discussion on the web visit https://groups.google.com/d/msg/cefsharp/-/IMtWhyep6VgJ.
To post to this group, send email to cefs...@googlegroups.com.
To unsubscribe from this group, send email to cefsharp+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cefsharp?hl=en.

Artem Golubev

unread,
Jan 22, 2013, 1:27:46 PM1/22/13
to cefs...@googlegroups.com
Tried simpler interface: exactly the same issue. Is there a way to see HTTP packets sent to localhost?
--

Artem.

This communication and any attachments may contain Confidential Information

of AppDirect, Inc. All unauthorized use, disclosure or distribution is prohibited. If

you are not the intended recipient, please notify AppDirect, Inc. immediately and

destroy all copies of this communication. Thank you.

Jack O'Connor

unread,
Jan 22, 2013, 6:43:28 PM1/22/13
to cefs...@googlegroups.com
The simplest way is to use "nc". For example, if I run "nc -l 80", and then navigate my browser to http://localhost, it will print out the full request that my browser sent. (I can even pipe a file or some terminal input into nc, and the browser will show the result as plain text. Kinda fun.) If you already have a webserver listening on port 80, you might need to use port 1234 or something random like that.

Artem Golubev

unread,
Jan 22, 2013, 7:39:19 PM1/22/13
to cefs...@googlegroups.com
Did it. Chromium does not pass the cookies to localhost. I also tried 1.19 version and it had the same issue for me. I wonder if someone ever been able to make it work.

Artem Golubev

unread,
Feb 5, 2013, 5:22:36 PM2/5/13
to cefs...@googlegroups.com
Opened a bug on this: https://github.com/chillitom/CefSharp/issues/102


On Tuesday, January 22, 2013 4:39:19 PM UTC-8, Artem Golubev wrote:
Did it. Chromium does not pass the cookies to localhost. I also tried 1.19 version and it had the same issue for me. I wonder if someone ever been able to make it work.

On Tue, Jan 22, 2013 at 3:43 PM, Jack O'Connor <oconn...@gmail.com> wrote:
The simplest way is to use "nc". For example, if I run "nc -l 80", and then navigate my browser to http://localhost, it will print out the full request that my browser sent. (I can even pipe a file or some terminal input into nc, and the browser will show the result as plain text. Kinda fun.) If you already have a webserver listening on port 80, you might need to use port 1234 or something random like that.
On Tue, Jan 22, 2013 at 10:27 AM, Artem Golubev <artem....@appdirect.com> wrote:
Tried simpler interface: exactly the same issue. Is there a way to see HTTP packets sent to localhost?
On Sun, Jan 20, 2013 at 12:21 PM, Jack O'Connor <oconn...@gmail.com> wrote:
Sorry for being slow to follow up here. I played briefly with cookies, and the main thing I remember is that it's pretty hard to get the parameters right. There is an overloaded SetCookie method, which takes fewer parameters and has some common defaults. Any chance that one works for you? My only other suggestion is to see if you can hack your cookie in using javascript. That would help rule out the possibility that your server has some cookie settings that are hurting you. (That actually happened to me once. The server I was working with had a cookies whitelist :p)
On Fri, Jan 18, 2013 at 6:15 PM, Artem Golubev <artem....@appdirect.com> wrote:
I'm sorry, I'm a newbie to .NET and CefSharp. In general it loads page great, but I can't figure out how to work with cookies. I use 0.12 version of CefSharp.
I'm setting cookies manually in my application, but server doesn't see them, is there some kind of bug out there or I miss something?
I set them before loading URL after I got Initialized event like this:
                            CEF.SetCookie(@"http://localhost:8080/CookiesShow/", @"localhost:8080", Name, Value, @"/CookiesShow", false, false, false, Expires);
I can see in the debug that cookies are being set, however my webserver does not receive them.
Did I miss something basic?

--
You received this message because you are subscribed to the Google Groups "CefSharp" group.
To view this discussion on the web visit https://groups.google.com/d/msg/cefsharp/-/IMtWhyep6VgJ.
To post to this group, send email to cefs...@googlegroups.com.
To unsubscribe from this group, send email to cefsharp+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/cefsharp?hl=en.

--
You received this message because you are subscribed to the Google Groups "CefSharp" group.
To post to this group, send email to cefs...@googlegroups.com.
To unsubscribe from this group, send email to cefsharp+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/cefsharp?hl=en.
--

Artem.

This communication and any attachments may contain Confidential Information

of AppDirect, Inc. All unauthorized use, disclosure or distribution is prohibited. If

you are not the intended recipient, please notify AppDirect, Inc. immediately and

destroy all copies of this communication. Thank you.

--
You received this message because you are subscribed to the Google Groups "CefSharp" group.
To post to this group, send email to cefs...@googlegroups.com.
To unsubscribe from this group, send email to cefsharp+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/cefsharp?hl=en.

--
You received this message because you are subscribed to the Google Groups "CefSharp" group.
To post to this group, send email to cefs...@googlegroups.com.
To unsubscribe from this group, send email to cefsharp+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/cefsharp?hl=en.

Alexander Stulov

unread,
Mar 17, 2013, 8:59:31 AM3/17/13
to cefs...@googlegroups.com, artem....@appdirect.com
To enable persistent cookies database feature should be enabled (BrowserSettings.DatabasesDisabled =  false)
Reply all
Reply to author
Forward
0 new messages