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         }

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-01-25
  • 2022-12-23
  • 2022-12-23
  • 2021-10-31
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-12
  • 2022-12-23
  • 2021-11-23
  • 2021-06-12
相关资源
相似解决方案