1 private void BtnOpenUrl_Click(object sender, EventArgs e) 2 { 3 if (txtUrl.Text != "") 4 { 5 MywebBrowser.Url = new Uri(txtUrl.Text); 6 } 7 } 8 9 private void BtnGetCookie_Click(object sender, EventArgs e)10 {11 CookieContainer myCookieContainer = new CookieContainer();12 if (MywebBrowser.Document.Cookie != null)13 {14 string cookieStr = MywebBrowser.Document.Cookie;15 string[] cookstr = cookieStr.Split(';');16 foreach (string str in cookstr)17 {18 string[] cookieNameValue = str.Split('=');19 Cookie ck = new Cookie(cookieNameValue[0].Trim().ToString(), cookieNameValue[1].Trim().ToString());20 ck.Domain = "www.google.com";21 myCookieContainer.Add(ck);22 }23 }24 }