| 
 | 
 
 string post = string.Format("truename={0}&sfzhm={1}&yzm={2}", textBox1.Text, sfz, textBox3.Text); 
            label3.Text = HtmlHelp.send("http://www.888.cn/comm/logon.php", post, "POST"); 
 
 
 
 public static string send(string url, string post, string method) 
        { 
            HttpWebRequest myHttpWebRequest; 
            byte[] oneData = { }; 
 
            Encoding encoding = Encoding.GetEncoding("UTF-8"); 
            oneData = encoding.GetBytes(post); 
 
            Uri uri = new Uri(url); 
            myHttpWebRequest = (HttpWebRequest)WebRequest.Create(uri);//请求的URL 
            myHttpWebRequest.ServicePoint.Expect100Continue = false;  加了这一句不提示417错误,提示err:002怎么办 
            myHttpWebRequest.CookieContainer = Cookies;//*发送COOKIE 
            myHttpWebRequest.Method = method; 
            myHttpWebRequest.ContentType = "application/x-www-form-urlencoded; charset=UTF-8"; 
            myHttpWebRequest.ContentLength = oneData.Length; 
            Stream newMyStream = myHttpWebRequest.GetRequestStream(); 
            newMyStream.Write(oneData, 0, oneData.Length); 
 
            try 
            { 
                HttpWebResponse response = (HttpWebResponse)myHttpWebRequest.GetResponse(); 
                StreamReader sr = new StreamReader(response.GetResponseStream(), Encoding.Default); 
 
                string str = sr.ReadToEnd(); 
 
                if (str.Length < 1) 
                { 
 
                    return "登陆成功,正在获取可预约信息" + Environment.NewLine; 
                } 
                    return str; 
 
 
            } 
            catch (Exception ex) 
            { 
                return ex.Message; 
            } 
        } 
 
 |   
 
 
 
 |