.net HttpClient 发送 form-urlencoded 数据

using (var client = new HttpClient())
{
    var values = new Liststring, string>>();
    values.Add(new KeyValuePair<string, string>("thing1", "hello"));
    values.Add(new KeyValuePair<string, string>("thing2 ", "world"));
 
    var content = new FormUrlEncodedContent(values);
 
    var response = await client.PostAsync("http://www.mydomain.com/recepticle.aspx", content);
 
    var responseString = await response.Content.ReadAsStringAsync();
}

 

转载于:https://www.cnblogs.com/Alex-ZJ/p/10283034.html

你可能感兴趣的:(.net HttpClient 发送 form-urlencoded 数据)