.Net HttpClient form-data格式请求
1 var multipartFormDataContent = new MultipartFormDataContent(); 2 multipartFormDataContent.Add(new StringContent("admin"), "UserName"); 3 multipartFormDataContent.Add(new StringContent("123456"), "Password"); 4 var client = _clientFactory.CreateClient(); 5 var response = await client.PostAsync("http://localhost", multipartFormDataContent); 6 if (response.IsSuccessStatusCode) 7 { 8 //do 9 }