string postData = "uUsername=avoid&uPassword=123456";
                    ASCIIEncoding encoding = new ASCIIEncoding();
                    byte[] data = encoding.GetBytes(postData);

                    request = (HttpWebRequest)WebRequest.Create(sUrl);
                    request.Method = "POST";
                    request.ContentType = "application/x-www-form-urlencoded";
                    request.ContentLength = data.Length;
                    Stream newStream = request.GetRequestStream();
                    newStream.Write(data, 0, data.Length);

                    newStream.Close();
                   
                    request.CookieContainer = cc;
                   
                    response = (HttpWebResponse)request.GetResponse();
                    cc.Add(response.Cookies);
                    stream = response.GetResponseStream();
                    sHtml = new StreamReader(stream, System.Text.Encoding.Default).ReadToEnd();
        private CookieContainer cc = new CookieContainer();

相关文章:

  • 2021-08-20
  • 2021-10-27
  • 2022-12-23
  • 2022-02-26
猜你喜欢
  • 2021-11-14
  • 2022-12-23
  • 2021-05-01
  • 2022-12-23
相关资源
相似解决方案