c#的http请求工具类核心代码
//post请求 var values = new Dictionary<string, string> { { "thing1", "hello" }, { "thing2", "world" } }; var content = new FormUrlEncodedContent(values); var responseString = client.PostAsync("http://www.example.com/recepticle.aspx", content).Content.ReadAsStringAsync().Result;
//get请求 var responseString = client.GetStringAsync("http://www.example.com/recepticle.aspx").Result;
原文:https://stackoverflow.com/questions/4015324/how-to-make-an-http-post-web-request