title: (CORS error) Can't send POST request (OPTIONS gets denied) with Angular to ASP.net REST services
body: <p>So, when I try sending POST request it doesn't succeed. Chrome prompts me with this error:</p>
  
  <pre><code>OPTIONS http://localhost:49475/api/Kpi/new (anonymous function) @ angular.js:10661sendReq @ angular.js:10480serverRequest @ angular.js:10187processQueue @ angular.js:14634(anonymous function) @ angular.js:14650Scope.$eval @ angular.js:15878Scope.$digest @ angular.js:15689Scope.$apply @ angular.js:15986(anonymous function) @ angular.js:23376n.event.dispatch @ jquery-2.1.4.min.js:3r.handle @ jquery-2.1.4.min.js:3
  
  Index.html:1 XMLHttpRequest cannot load http://localhost:49475/api/MYLINK. Response for preflight has invalid HTTP status code 405
  </code></pre>
  
  <p>I highly doubt my request is the problem, but it looks like this:</p>
  
  <pre><code>return $http.post(apiAddress + 'mylink', dataObj)
              .then(function (response) {
                  console.log("succeeded");
                  return response.status;
              }, function (response) {
                  console.log("failed");
                  return response.status;
              });
  </code></pre>
  
  <p>I have installed CORS on my API part, server one, and enabled it in WebApiConfig:</p>
  
  <pre><code>var cors = new EnableCorsAttribute("*", "*", "*");
  config.EnableCors(cors);
  </code></pre>
  
  <p>I have also edited my Web.config file and enabled all of Access Controls variables with:</p>
  
  <pre><code>&lt;httpProtocol&gt;
        &lt;customHeaders&gt;
          &lt;add name="Access-Control-Allow-Origin" value="*" /&gt;
          &lt;add name="Access-Control-Allow-Methods" value="GET, PUT, POST, DELETE, OPTIONS" /&gt;
          &lt;add name="Access-Control-Allow-Headers" value="Origin, X-Requested-With, Content-Type, Accept" /&gt;
        &lt;/customHeaders&gt;
  &lt;/httpProtocol&gt;
  </code></pre>
  
  <p>My client side is running on localhost:57810 and the server one is on localhost:49475. I have been looking for this to work for nearly 6 hours now. I've tried every possible snippet and "solution" I could find online and it is unsuccessfull. I wouldn't have posted this question if it was...</p>
  
  <p>I appreciate any answer I get...</p>
  
  <p>EDIT: Post method works as expected, I have tested it with Postman. Now, sending OPTIONS request to the mentioned url (api/mylink) doesn't work.</p>
  
  <p>It returns:</p>
  
  <pre><code>{"Message":"The requested resource does not support http method 'OPTIONS'."}
  </code></pre>