0

Well This questions as far I was searching never been asked before...

I'm trying to extract a cookie value from my webbrowser control I wasn't been able to find any helpful information I want to extract the cookies values after webbrowser navigate:

 private void Form1_Load(object sender, EventArgs e)
        {
            webBrowser1.Navigate("http://site.com");
        }

I have a nice code for regex find for httpwebreqest something similar to webbrowser control is what I'm trying to do:

   List<string> cookieValues = new List<string>();
            foreach (Cookie cookie in agent.LastResponse.Cookies)
            {
                cookieValues.Add(cookie.Value);
            }
  foreach (string i in cookieValues)
            {
                Match match2 = Regex.Match(i, @"bert=([\w]*)",
                   RegexOptions.IgnoreCase);

                // Ensure match
                if (match2.Success)
                {
                    // Finally, we get Group value and display it.
                    key2 = match2.Groups[1].Value;

                }

Honestly I didn't play with webbrowser so I got no clue where to start. Got any ideas? From what I been researching it's possible Webbrowser control are the same cookies in IE?

Boris Daka
  • 603
  • 2
  • 17
  • 32
  • Mark, this should help http://stackoverflow.com/questions/650536/c-sharp-webrequest-using-webbrowser-cookie – tempidope Oct 07 '12 at 23:56
  • possible duplicate of [C# Scrape Cookie Values From WebBrowser Control?](http://stackoverflow.com/questions/12772904/c-sharp-scrape-cookie-values-from-webbrowser-control) – Jonathan Leffler Apr 11 '13 at 12:23

0 Answers0