从WebBrowser中取得Cookie 的代码 CookieContainer myCookieContainer = new CookieContainer(); string cookieStr = webBrowser1.Document.Cookie; string[] cookstr = cookieStr.Split(';'); foreach (string str in cookstr) WebClient设置cookie! WebClient wc = new WebClient(); wc.Headers.Add("Cookie", "PHPSESSID=" + cookie + ";");//~~~~~~~注意,这里是Cookie,不是Set-Cookie byte[] re = wc.UploadData(Global.RootPath + "test.php", new byte[0]); System.Text.UTF8Encoding converter = new System.Text.UTF8Encoding(); string str = converter.GetString(re); 相关文章: