日期:2014-05-18  浏览次数:20748 次

在WinFrom中如何通过Http协议Get、Post向服务器获取数据..
在WinFrom中如何通过Http协议Get、Post向服务器获取数据..
请求各位大虾帮忙,最好是有源代码的..


------解决方案--------------------
可以用httpwebRequest 
HttpWebRequest HttpWReq = 
(HttpWebRequest)WebRequest.Create("http://www.contoso.com");
// Turn off connection keep-alives.
HttpWReq.KeepAlive = false;

HttpWebResponse HttpWResp = (HttpWebResponse)HttpWReq.GetResponse();

// Get the HTTP protocol version number returned by the server.
String ver = HttpWResp.ProtocolVersion.ToString();
HttpWResp.Close();