title: text/plain Media Type not being accepted for WebApi v2
body: <p>This problem started off with IE9, where for <code>POST</code> requests, the <code>contentType</code> has to be <code>text/plain</code>, and <code>application/json</code> will not work.</p>
  
  <p>I've added the <a href="https://github.com/MoonScript/jQuery-ajaxTransport-XDomainRequest" rel="nofollow noreferrer">moonscript</a> and proceeded to use <code>contentType: text/plain</code>. I've also added the custom media type to the api, as shown on numerous forms below:</p>
  
  <ul>
  <li><a href="http://www.stormbase.net/2015/09/21/webapi-post-plaintext/" rel="nofollow noreferrer">http://www.stormbase.net/2015/09/21/webapi-post-plaintext/</a></li>
  <li><a href="https://stackoverflow.com/questions/25631970/how-to-post-plain-text-to-asp-net-web-api-endpoint">how to post plain text to ASP.NET Web API endpoint?</a> </li>
  </ul>
  
  <p>And added the insertion of the <code>text/plain</code> media type to the <code>WebApiConfig</code></p>
  
  <pre><code>config.Formatters.JsonFormatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue("text/html"));
  config.Formatters.JsonFormatter.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
  config.Formatters.JsonFormatter.SerializerSettings.Formatting = Newtonsoft.Json.Formatting.Indented;
  
  // allows 'text/plain' as a supported media type
  config.Formatters.Add(new TextMediaTypeFormatter());
  </code></pre>
  
  <p>However, when posting in IE9 (using emulation), I am still receiving a <code>415 Unsupported Media Type</code></p>
  
  <p><code>Key        Value
  Response    HTTP/1.1 415 Unsupported Media Type</code></p>
  
  <pre><code>$.ajax({
      type: "POST",
      url: hope_forms.viivApiUrl + 'newsletter',
      contentType: 'text/plain',
      data: JSON.stringify(model),
      success: function (data) {
             .....
      },
      error: function (responseText) {
             console.log(responseText)
             modal.showModal('Something went wrong, please try again.');
     }                    
  });
  </code></pre>
  
  <p>Addition:</p>
  
  <p>Here's the full blown <code>WebApiConfig</code> in the event that something is out of order:</p>
  
  <pre><code>var cors = new EnableCorsAttribute("*", "*", "*");
  config.EnableCors(cors);
  
  config.Routes.MapHttpRoute(
      name: "DefaultApi",
      routeTemplate: "api/{controller}/{id}",
      defaults: new { id = RouteParameter.Optional }
  );
  
  // Uncomment the following line of code to enable query support for actions with an IQueryable or IQueryable&lt;T&gt; return type.
  // To avoid processing unexpected or malicious queries, use the validation settings on QueryableAttribute to validate incoming queries.
  // For more information, visit http://go.microsoft.com/fwlink/?LinkId=279712.
  //config.EnableQuerySupport();
  
  config.EnableSystemDiagnosticsTracing();
  
  
  //config.Formatters.JsonFormatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue("text/html"));
  config.Formatters.JsonFormatter.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
  config.Formatters.JsonFormatter.SerializerSettings.Formatting = Newtonsoft.Json.Formatting.Indented;
  
  // allows 'text/plain' as a supported media type
  config.Formatters.Add(new TextMediaTypeFormatter());
  </code></pre>
  
  <p>I also changed the <code>ajaxTransport xhr</code> wrapper to use this instead:
  <a href="https://github.com/gfdev/javascript-jquery-transport-xdr" rel="nofollow noreferrer">https://github.com/gfdev/javascript-jquery-transport-xdr</a></p>
  
  <hr>
  
  <p><strong>Note:</strong></p>
  
  <p>As of today, 09/21, I've switched all my <code>POST</code> requests to <code>GET</code>, but I still would like a work-around to get these types back to <code>POST</code>. </p>