如果像我一样,你面对的是一些只接受表单内容的第三方网络服务,你可以解决这个问题:

// Let's assume you've got your key-value pairs organised into a nice Dictionary<string, string> called formData
var encodedItems = formData.Select(i => WebUtility.UrlEncode(i.Key) + "=" + WebUtility.UrlEncode(i.Value));
var encodedContent = new StringContent(String.Join("&", encodedItems), null, "application/x-www-form-urlencoded");

// Post away!
var response = await client.PostAsync(url, encodedContent);

相关文章:

  • 2022-12-23
  • 2021-08-12
  • 2021-11-06
  • 2021-08-18
  • 2022-12-23
  • 2021-05-24
  • 2022-01-28
猜你喜欢
  • 2021-07-09
  • 2022-12-23
  • 2022-12-23
  • 2023-02-10
  • 2022-12-23
  • 2022-12-23
  • 2022-01-08
相关资源
相似解决方案