var postContent = new MultipartFormDataContent();
postContent.Headers.Add("ContentType", $"multipart/form-data");

//这是【string : string】的键值对
postContent.Add(new StringContent(appConfig.apiName), "api_name");

//这是【string : Json】的键值对;param是一个类的对象
postContent.Add(new StringContent(param.ToJsonStr()), "content");


//form表单格式传参

string result = "";

string url = "http://xxxxx.cn";
try
{
  HttpClient client = new HttpClient();
  HttpResponseMessage response = client.PostAsync(url, postData).Result;
  result = response.Content.ReadAsStringAsync().Result;
}
catch (Exception ex)
{
  result = ex.Message;
}

相关文章:

  • 2021-11-27
  • 2022-12-23
  • 2022-01-15
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-01
  • 2021-04-20
猜你喜欢
  • 2022-12-23
  • 2021-12-21
  • 2022-12-23
  • 2021-11-27
  • 2021-11-27
  • 2022-12-23
相关资源
相似解决方案