c# WebBrowser获取cookie

         private void BtnOpenUrl_Click(object sender, EventArgs e)
{
if (txtUrl.Text != "")
{
MywebBrowser.Url = new Uri(txtUrl.Text);
}
} private void BtnGetCookie_Click(object sender, EventArgs e)
{
CookieContainer myCookieContainer = new CookieContainer();
if (MywebBrowser.Document.Cookie != null)
{
string cookieStr = MywebBrowser.Document.Cookie;
string[] cookstr = cookieStr.Split(';');
foreach (string str in cookstr)
{
string[] cookieNameValue = str.Split('=');
Cookie ck = new Cookie(cookieNameValue[].Trim().ToString(), cookieNameValue[].Trim().ToString());
ck.Domain = "www.google.com";
myCookieContainer.Add(ck);
}
}
}
上一篇:Eclipse导出可执行Java工程/可执行Jar文件(包含第三方Jar包)


下一篇:w10下Oracle 11g完全干净卸载