📅  最后修改于: 2022-03-11 14:49:02.748000             🧑  作者: Mango
using System.Net.Http;
HttpClient client = new HttpClient();
/// POST ///
var values = new Dictionary
{
{ "thing1", "hello" },
{ "thing2", "world" }
};
var content = new FormUrlEncodedContent(values);
var response = await client.PostAsync("http://www.example.com/recepticle.aspx", content);
var responseString = await response.Content.ReadAsStringAsync();
/// GET ///
var responseString = await client.GetStringAsync("http://www.example.com/recepticle.aspx");