搬砖搬砖~
Content-Type:application/x-www-form-urlencoded的请求如下
var nvc = new List<KeyValuePair>(); nvc.Add(new KeyValuePair("account", "")); nvc.Add(new KeyValuePair("password", "")); var client = new HttpClient(); var req = new HttpRequestMessage(HttpMethod.Post, url) { Content = new FormUrlEncodedContent(nvc) }; var res = await client.SendAsync(req); var s=await res.Content.ReadAsStringAsync();
参考资料
How to POST using HTTPclient content type = application/x-www-form-urlencoded