title: Why do I get "invalid_form_data" error when trying to post to Slack-API?
body: <p>When I use this method:</p>
  
  <pre><code>public async Task&lt;HttpResponseMessage&gt; UploadFileAsync(MultipartFormDataContent requestContent)
  {
      HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, UriMethod);
      request.Content = requestContent;
      var response = await _httpClient.SendAsync(request);
  
      return response;
  }
  </code></pre>
  
  <p>I allways get the answer:</p>
  
  <pre><code>{"ok":false,"error":"invalid_form_data"}
  </code></pre>
  
  <p>so I tried to explicitly tell it the 'mediaType', I tried "application/json" and others, but with all of them I get the same error. Here is the full Main-method that calls the upper method:</p>
  
  <pre><code>    namespace TestArea
      {
          class MainArea
          {
              public static void Main( string[] args)
              {
                  try
                  {
                      Task.WaitAll(SendMessage());
                  }
                  catch(Exception ex)
                  {
                      Console.WriteLine(ex);
                      Console.ReadKey();
                  }
              }
  
   private static async Task SendMessage()
      {
          var client = new BpsHttpClient("https://slack.com/api/chat.postMessage");
          JsonObject JO = new JsonObject();
          JO.channel = "DCW21NBHD";
          JO.text = "This is so much fun :D !";
          var Json = JsonConvert.SerializeObject(JO, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });
  
          var StringJson = new StringContent(Json, Encoding.UTF8, "application/json");
  
          var requestContent = new MultipartFormDataContent();
          requestContent.Add(StringJson);
  
          var Response = await client.UploadFileAsync(requestContent);
  
          string AnswerContent = await Response.Content.ReadAsStringAsync();
  
      }
  </code></pre>
  
  <p>When I use this method:</p>
  
  <pre><code>public async Task&lt;HttpResponseMessage&gt; SendMessageAsync(FormUrlEncodedContent content)
  {
      var response = await _httpClient.PostAsync(UriMethod, content);
  
      return response;
  }
  </code></pre>
  
  <p>so basically I am passing "FormUrlEncodedContent" instead of "MultipartFormDataContent" in this, and then I get the response I want and can work wiht it. BUT this is of little use to me since I have to use "MultipartFormDataContent" to be able to send files with my requests.</p>
  
  <p>Anyone have an idea what is failing here? Why does it not like the one content-type but the other one? I'd be gratefull for tipps and ideas!</p>