.net webrequest应用
StringBuilder sb = new StringBuilder("data=1");
byte[] bytes = Encoding.UTF8.GetBytes(sb.ToString());
WebRequest req = WebRequest.Create("http://baidu.com?");
req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded";
req.ContentLength = bytes.Length;
Stream reqSt = req.GetRequestStream();
reqSt.Write(bytes, 0, bytes.Length);
reqSt.Close();
WebResponse rep = req.GetResponse();
Stream st = rep.GetResponseStream();
StreamReader reader = new StreamReader(st);
string txt = reader.ReadToEnd();
reader.Close(); st.Close();
}