有关http post的问题
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();
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();