一、GET请求
using (var client = new WebClient()){ var responseString = client.DownloadString("http://www.example.com/Test?name=test");}
二、POST请求
using (var client = new WebClient()){ var values = new NameValueCollection(); values["x"] = "106.312859432537"; values["y"] = "29.6603971422907"; var response = client.UploadValues("http://173.12.1.30:7654/baiducoordinate/Coordinates.asmx/baidutowgs84", values); var responseString = Encoding.Default.GetString(response);}