< DOCTYPE html PUBLIC -WCDTD XHTML StrictEN httpwwwworgTRxhtmlDTDxhtml-strictdtd>
我用的是WebClient这个类来做的,如
try
{
WebClient wc = new WebClient();
wc.Headers.Add( "Content-Type ", "application/x-www-form-urlencoded ");
wc.Headers.Add( "User-Agent ", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;.NET CLR 1.1.4322) ");
wc.Headers.Add( "Accept ", "*/*) ");
string postStr = "AAA=1&BBB=2 ";
byte [] postData = Encoding.ASCII.GetBytes(postStr);
byte [] returnData = wc.UploadData( "http://www.xxxx.com/aaa ", "POST ", postData);
string returnStr = Encoding.GetEncoding( "GB2312 ").GetString(returnData);
MessageBox.Show(returnStr);
}catch(Exception ex)
{
MessageBox.Show(ex.Message);
}