title: C#: Sending parameter with Content-Type Header in HTTP
body: <p>I am trying to send the HTTP <code>post</code> request using <code>HTTP client</code>.while setting my  <code>Content-Type</code> header with <code>StringContent</code> method, I am getting the error:</p>
  
  <blockquote>
    <p>the format "application/json;ty=2 "is incorrect</p>
  </blockquote>
  
  <p>My code is as follows:</p>
  
  <pre><code>string result2 = JsonConvert.SerializeObject(values);
   var content = new StringContent(result2, Encoding.UTF8, "application/json; ty=2");
   var response = await client.PostAsync("http://127.0.0.1:8080/~/in-cse/in-name", content);
                      var response_string = await response.Content.ReadAsStringAsync();
  </code></pre>
  
  <p>But in my HTTP Post format I have to include <code>ty=2</code> parameter along with <code>application/json</code>. I have tested this with <code>Postman</code>and it worked perfectly. How can I achieve the same thing here. I also even found you can add parameter to content type in the following format:
   <code>content := "Content-Type" ":" type "/" subtype *(";" parameter)</code> 
  then why is it not working for me.
  **EDIT:**even tried this:</p>
  
  <pre><code> HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, "http://127.0.0.1:8080/~/in-cse/in-name");
                      request.Content = new StringContent(result2, Encoding.UTF8, "application/json;ty=2");
  
                      client.SendAsync(request).ContinueWith(resposetask =&gt; { Console.WriteLine("response:{0}", resposetask.Result); });
  </code></pre>
  
  <p>same error i am getting</p>