Cookies not sent in WebBrowser? (C#, VS2008)

Posted by Ivan on Stack Overflow See other posts from Stack Overflow or by Ivan
Published on 2010-04-25T11:39:15Z Indexed on 2010/04/25 11:43 UTC
Read the original article Hit count: 513

Filed under:
|
|
|

Hi, I'm trying to add cookies to a webbrowser from a cookiecollection. I add them as they should be added but then they are not sent when the request is done. Here is the code I have done hitherto:

        public void myNav(string url, CookieCollection cc)
        {

            foreach (Cookie cook in cc)
            {
                webBrowser1.Document.Cookie = cook.ToString();
            }

            this.webBrowser1.Navigate(url);
            Clipboard.SetText(webBrowser1.Document.Cookie);
        }

If I copy the cookies to the clipboard they are sent correctly, but If I analyse the request with Wireshark they are not sent in the headers.

How can I solve this?

Thanks in advance, Ivan

© Stack Overflow or respective owner

Related posts about webbrowser

Related posts about c#