1. 程式人生 > >.net HttpClient 發送 form-urlencoded 數據

.net HttpClient 發送 form-urlencoded 數據

.net main esp pre code sin sta col ()

using (var client = new HttpClient())
{
    var values = new List<KeyValuePair<string, 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(); }

.net HttpClient 發送 form-urlencoded 數據