.net Core 调用api里的post方法之 form传值
HttpClient client = new HttpClient(); client.Timeout = new TimeSpan(0, 45, 0); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("multipart/form-data"));
MultipartFormDataContent content = new MultipartFormDataContent(); content.Add(new StringContent("1"), "pageIndex"); content.Add(new StringContent("25"), "pageSize"); var result = client.PostAsync(url, content).Result.Content.ReadAsStringAsync().Result;