int remember = 0; if (checkBox1.Checked) { remember = 1; } else remember = 0; string PostData = string.Format("url=%2Fhome%2F&email=" + Email.Text + "&password=" + Pwd.Text + "&remember=" + remember); byte[] FinalPostData = Encoding.UTF8.GetBytes(PostData); HttpWebRequest request = (HttpWebRequest)WebRequest.Create(targetURL); //构造请求 CookieContainer cc = new CookieContainer(); request.KeepAlive = true; request.CookieContainer = cc; request.Method = "POST"; request.ContentType = "application/x-www-form-urlencoded"; request.ContentLength = PostData.Length; request.UserAgent = "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022)"; Stream newStream = request.GetRequestStream(); newStream.Write(FinalPostData, 0, FinalPostData.Length); //发送请求 newStream.Close(); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); //构造应答 Stream stream = response.GetResponseStream(); string result = new StreamReader(stream, System.Text.Encoding.UTF8).ReadToEnd(); response.Close();