title: WebAPI, [FromBody] string, application/json, Error 415 (Unsupported Media Type)
body: <p>I have a WebAPI project (c#) and i test it with my page (Index.cshtml):</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  ...
  &lt;/head&gt;
  &lt;body&gt;
  
      &lt;script src="@Url.Content("~/Scripts/jquery-3.2.1.js")" type="text/javascript"&gt;&lt;/script&gt;
      &lt;script type="text/javascript"&gt;
  
      function GetData() {
          $.ajax({
              url: "http://localhost:0000/api/test/test/cox/Test",
              type: 'POST',
              dataType: 'json',
              data: JSON.stringify("Hello!!!"),
              crossDomain: true,
              processData: false,
              contentType: 'application/json, charset=utf-8',
              headers: { User: "test", Password: "test" },
              success: function (q, w, e) {
                  alert(JSON.stringify(q));
              },
              error: function (q, w, e) {
                  alert("error: " + w);
              }
          });
      }
  
  &lt;/script&gt;
  
  &lt;p&gt;
      &lt;button onclick="GetData()"&gt;GetData&lt;/button&gt;
  &lt;/p&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>This page call my method:</p>
  
  <pre><code>[HttpPost]
  [ResponseType(typeof(IEnumerable&lt;СompositeType&gt;))]
  public HttpResponseMessage Test(string cox, [FromBody] string str)
  {
     ...    
  }
  </code></pre>
  
  <p>and i get the error: 415 "Unsupported Media Type". I read about this error and somebody is talking that <code>contentType: 'application/json, charset=utf-8'</code> will solve the problem. I know that attribute [FromBody] call to <code>contentType: 'application/json'</code> for transformation , but i don't undestand why i have the error 415.  </p>