title: The provided ContentType is not supported; the supported types are 'application/json' in blazor
body: <p>I am calling a blazor serverapp(webwebapi) in blazor webassemblyapp(client side) but I am facing content type error:</p>
  <pre><code>crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
        Unhandled exception rendering component: The provided ContentType is not supported; the supported types are 'application/json' and the structured syntax suffix 'application/+json'.
  System.NotSupportedException: The provided ContentType is not supported; the supported types are 'application/json' and the structured syntax suffix 'application/+json'.
    at System.Net.Http.Json.HttpContentJsonExtensions.ValidateContent (System.Net.Http.HttpContent content) &lt;0x32571f8 + 0x0009a&gt; in &lt;filename unknown&gt;:0 
    at System.Net.Http.Json.HttpContentJsonExtensions.ReadFromJsonAsync[T] (System.Net.Http.HttpContent content, System.Text.Json.JsonSerializerOptions options, System.Threading.CancellationToken cancellationToken) &lt;0x3256ff0 + 0x00006&gt; in &lt;filename unknown&gt;:0 
    at System.Net.Http.Json.HttpClientJsonExtensions.GetFromJsonAsyncCore[T] (System.Threading.Tasks.Task`1[TResult] taskResponse, System.Text.Json.JsonSerializerOptions options, System.Threading.CancellationToken cancellationToken) &lt;0x321fd50 + 0x0011c&gt; in &lt;filename unknown&gt;:0 
    at CrudBlazorClientApp.Pages.Index.Login () [0x00106] in C:\Users\FrontTech\source\repos\CrudBlazorServerApp\CrudBlazorClientApp\Pages\Index.razor:31 
    at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion (System.Threading.Tasks.Task task) &lt;0x3220cb0 + 0x000da&gt; in &lt;filename unknown&gt;:0 
    at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask (System.Threading.Tasks.Task taskToHandle) &lt;0x3156c98 + 0x000b6&gt; in &lt;filename unknown&gt;:0 
  </code></pre>
  <p>EmpsController.cs</p>
  <pre><code>namespace CrudBlazorServerApp.Controllers
  {
      [Route(&quot;api/[controller]&quot;)]
      [ApiController]
      public class EmpsController : ControllerBase
      {
          //here I create a custom login webapi 
          [HttpPost]
          [Consumes(&quot;application/json&quot;)]
          public Emp checkLogin(string username, string password)
          {
              Emp hasemp = _context.emps.Where(e =&gt; e.username == username &amp; e.password == password).FirstOrDefault();
              return hasemp;
          }
  </code></pre>
  <p>see above webapi response</p>
  <p><a href="https://i.stack.imgur.com/X7fMH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/X7fMH.png" alt="enter image description here" /></a></p>
  <p>see watch window</p>
  <p><a href="https://i.stack.imgur.com/1swSe.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1swSe.png" alt="enter image description here" /></a></p>
  <p>see console log</p>
  <p><a href="https://i.stack.imgur.com/jYDuC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jYDuC.png" alt="enter image description here" /></a></p>
  <p>Request Header</p>
  <p><a href="https://i.stack.imgur.com/4t9oX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4t9oX.png" alt="enter image description here" /></a></p>
  <p>Response</p>
  <p>failed to load response data</p>
  <p>Index.razor</p>
  <pre><code>@page &quot;/&quot;
  @using CrudBlazorServerApp.Data
  @inject HttpClient Http
  @inject NavigationManager navigationManager
  @*@inject CrudBlazorServerApp.Data.sqldbcontext _sqldbcontext*@
  @using Newtonsoft.Json;
  &lt;div&gt;
      UserName:&lt;input id=&quot;txtusername&quot; type=&quot;text&quot; placeholder=&quot;Enter Your UserName&quot; @bind=&quot;@username&quot; /&gt;&lt;br /&gt;
      Password:&lt;input id=&quot;txtpassword&quot; type=&quot;text&quot; placeholder=&quot;Enter Your Password&quot; @bind=&quot;@password&quot; /&gt;&lt;br /&gt;
      &lt;button @onclick=&quot;Login&quot;&gt;Log In&lt;/button&gt;
  &lt;/div&gt;
  
  @code{
      string username = &quot;&quot;;
      string password = &quot;&quot;;
      Emp empList = new Emp();
      protected async Task Login()
      {
          @if (username == &quot;&quot; || username == null &amp;&amp; password == &quot;&quot; || password == null)
          {
              var data = new
              {
                  message = &quot;Enter Username &quot;,
              };
          }
          else
          {
              var client = new HttpClient();
              client.DefaultRequestHeaders.Accept.Clear();
              client.DefaultRequestHeaders.Add(&quot;Accept&quot;, &quot;application/json&quot;);
              empList = await client.GetFromJsonAsync&lt;Emp&gt;(&quot;https://localhost:44333/api/emps/checkLogin?username=&quot; + empList.username + &quot;&amp;password=&quot; + empList.password);
  
              @if (username == empList.username || password == empList.password)
              {
                  var data = new
                  {
                      message = &quot;Success&quot;,
                      data = new { empList.username, empList.password }
                  };
  
                  navigationManager.NavigateTo(&quot;/registration&quot;);
  
              }
              else
              {
                  var data = new
                  {
                      message = &quot;Username and Password incorrect &quot;,
                  };
                  navigationManager.NavigateTo(&quot;/index&quot;);
              }
          }
      }
  }
  </code></pre>
  <p>when I am debugging this line generate an error:</p>
  <pre><code>empList = await client.GetFromJsonAsync&lt;Emp&gt;(&quot;https://localhost:44333/api/emps/checkLogin?username=&quot; + empList.username + &quot;&amp;password=&quot; + empList.password);
  </code></pre>
  <p>and emplist is also null</p>
  <p>help</p>