title: The remote server returned an error: (415) Unsupported Media Type Vb dot net
body: <p>I am facing the issue in one of my vb dot net application while posting the values to web api method.</p>
  <p>My code:</p>
  <pre><code>Dim uri As String = &quot;http://server/api/TMS/CreateIndent&quot;
  Dim request As Net.HttpWebRequest = Net.HttpWebRequest.Create(uri)
  Dim headers As WebHeaderCollection = New WebHeaderCollection()
  Dim tokenurl As String = Token
  
  request.ContentType = &quot;multipart/form-data&quot;
  request.Method = &quot;POST&quot;
  headers.Add(&quot;Token&quot;, tokenurl)
  headers.Add(&quot;NTID&quot;, &quot;abcdef&quot;)
  request.Headers = headers
  
  Dim value As String = &quot;[{&quot;&quot;PurposeId&quot;&quot; : &quot;&quot;4&quot;&quot;,&quot;&quot;MitraIndentId&quot;&quot;: &quot;&quot;558&quot;&quot;,&quot;&quot;Employee&quot;&quot;:{&quot;&quot;NTID&quot;&quot;: &quot;&quot;abcdedf&quot;&quot;},&quot;&quot;Purposeothers&quot;&quot;: &quot;&quot;null&quot;&quot;, &quot;&quot;TravellingDetails&quot;&quot;:[{&quot;&quot;ModeOfTravelID&quot;&quot;: &quot;&quot;4&quot;&quot;,&quot;&quot;DepartureDate&quot;&quot;:&quot;&quot;01/02/2022 16:23&quot;&quot;,&quot;&quot;DepartedFrom&quot;&quot;:&quot;&quot;TD1&quot;&quot;,&quot;&quot;ArrivalDate&quot;&quot;:&quot;&quot;02/02/2022 16:24&quot;&quot;,&quot;&quot;ArrivalAt&quot;&quot;:&quot;&quot;TD2&quot;&quot;,&quot;&quot;BoschCost&quot;&quot;:&quot;&quot;123&quot;&quot;,&quot;&quot;EmployeeCost&quot;&quot;:&quot;&quot;500&quot;&quot;,&quot;&quot;IsSupportDocumnentAvailable&quot;&quot;:&quot;&quot;true&quot;&quot;,&quot;&quot;DeviationKey&quot;&quot;:&quot;&quot;1644404033300&quot;&quot;}]}]&quot;
  
  Dim array(1) As Char
  array(0) = &quot;[&quot;
  array(1) = &quot; &quot;
  Dim value1 As String = value.Remove(value.Length - 1)
  Dim value2 As String = value1.TrimStart(array)
  Dim keyparameter = New Dictionary(Of String, Object) From {
  {&quot;Expense&quot;, value2}}
  
  Dim PostString As String = JsonConvert.SerializeObject(keyparameter)
  Dim byteArray As Byte() = Encoding.UTF8.GetBytes(PostString)
  request.ContentLength = byteArray.Length
  Dim dataStream As IO.Stream = request.GetRequestStream()
  dataStream.Write(byteArray, 0, byteArray.Length)
  dataStream.Close() 'sends request
  
  Dim myResp As HttpWebResponse = request.GetResponse()
  </code></pre>
  <p>While getting the response, I am getting the issue.</p>
  <p>Error: The remote server returned an error: (415) Unsupported Media Type</p>
  <p>But if i use the same json string in postman, its working fine.</p>
  <p>Postman code:</p>
  <pre><code>POST //api/TMS/CreateIndent HTTP/1.1
  Host: 
  Token: sZnYPDJE454wx7m3FMNvTFe5k6fATnKUgUE3toV5MEgB8ydfni
  NTID: abcdefg
  Cache-Control: no-cache
  Postman-Token: 44836019-b3d4-c143-3c1f-5dbff2834584
  Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
  
  ------WebKitFormBoundary7MA4YWxkTrZu0gW
  Content-Disposition: form-data; name=&quot;Expense&quot;
  
  {&quot;PurposeId&quot; : &quot;4&quot;,&quot;MitraIndentId&quot;: &quot;558&quot;,&quot;Employee&quot;:{&quot;NTID&quot;: &quot;abcdefg&quot;},&quot;Purposeothers&quot;: &quot;null&quot;, &quot;TravellingDetails&quot;:[{&quot;ModeOfTravelID&quot;: &quot;4&quot;,&quot;DepartureDate&quot;:&quot;01/02/2022 16:23&quot;,&quot;DepartedFrom&quot;:&quot;TD1&quot;,&quot;ArrivalDate&quot;:&quot;02/02/2022 16:24&quot;,&quot;ArrivalAt&quot;:&quot;TD2&quot;,&quot;BoschCost&quot;:&quot;123&quot;,&quot;EmployeeCost&quot;:&quot;500&quot;,&quot;IsSupportDocumnentAvailable&quot;:&quot;true&quot;,&quot;DeviationKey&quot;:&quot;1644404033300&quot;}]}
  ------WebKitFormBoundary7MA4YWxkTrZu0gW--
  </code></pre>
  <p>Please help me to resolve this issue.</p>
  <p>Thanks in advance</p>