title: Ajax Response to preflight request doesn't pass access control
body: <p>I have been looking for 5 hours or so but i give up.
  my ajax get request just does't want to work.</p>
  
  <pre><code>var ApiResponce = $.ajax({
      url: "http://localhost:18428/api/Reservation/" + userid + "?weekNumber=" + weeknr,
      type: 'GET',
      headers: {
          'Authorization': "bearer " + token,  
          'Access-Control-Allow-Origin': '*',
          'Access-Control-Allow-Credentials': true,
      },
      dataType: 'json',
      crossDomain: true,
      contentType: "application/json",
  
      success: function(responce) {
          console.log("success");
          console.log(responce);
      },
      error: function(err) {
        console.log("error");
          console.log(ApiResponce);
      },
  });
  </code></pre>
  
  <p>it connecting to a standard C# mvc api but all that i am getting is this error:</p>
  
  <blockquote>
    <p>XMLHttpRequest cannot load <a href="http://localhost:18428/api/Reservation/1?weekNumber=1" rel="nofollow noreferrer">http://localhost:18428/api/Reservation/1?weekNumber=1</a>. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '<a href="http://localhost" rel="nofollow noreferrer">http://localhost</a>' is therefore not allowed access. The response had HTTP status code 405.</p>
  </blockquote>