都老问题了 可是我还是不明白~~~始终没成功~~~~~~ 用了很多种方法 没解决~~~~希望你们帮我下~~ 谢谢了~~~~
string strId = TextBox1.Text;
string strPassword = TextBox2.Text; ASCIIEncoding encoding = new ASCIIEncoding();
string postData = "?refurl=http://www.livecq.cn/bbs/index.aspx&name=" + strId;
postData += ("&password=" + strPassword + "&savedays=-1");
byte[] data = encoding.GetBytes(postData); // Prepare web request...
HttpWebRequest myRequest =
(HttpWebRequest)WebRequest.Create("http://www.livecq.cn/bbs/user_login.aspx"); myRequest.Method = "POST";
myRequest.ContentType = "application/x-www-form-urlencoded";
myRequest.ContentLength = data.Length;
Stream newStream = myRequest.GetRequestStream(); // Send the data.
newStream.Write(data, 0, data.Length);
newStream.Close(); // Get response
HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse();
StreamReader reader = new StreamReader(myResponse.GetResponseStream(), Encoding.Default);
string content = reader.ReadToEnd();
Console.WriteLine(content);
string strId = TextBox1.Text;
string strPassword = TextBox2.Text; ASCIIEncoding encoding = new ASCIIEncoding();
string postData = "?refurl=http://www.livecq.cn/bbs/index.aspx&name=" + strId;
postData += ("&password=" + strPassword + "&savedays=-1");
byte[] data = encoding.GetBytes(postData); // Prepare web request...
HttpWebRequest myRequest =
(HttpWebRequest)WebRequest.Create("http://www.livecq.cn/bbs/user_login.aspx"); myRequest.Method = "POST";
myRequest.ContentType = "application/x-www-form-urlencoded";
myRequest.ContentLength = data.Length;
Stream newStream = myRequest.GetRequestStream(); // Send the data.
newStream.Write(data, 0, data.Length);
newStream.Close(); // Get response
HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse();
StreamReader reader = new StreamReader(myResponse.GetResponseStream(), Encoding.Default);
string content = reader.ReadToEnd();
Console.WriteLine(content);
但返回的页面中文就显示乱码