Response to preflight request doesn't pass access control check (Angular2) : <p>I am getting below error on call to REST Web API in Asp.net.</p>

<p><strong>XMLHttpRequest cannot load <a href="http://localhost:54859/api/PostData" rel="noreferrer">http://localhost:54859/api/PostData</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:3000" rel="noreferrer">http://localhost:3000</a>' is therefore not allowed access.</strong></p>

<p>I am using Angular2 as Front end. In the back end, I have added following codes to enable CORS in WEB API.</p>

<pre><code> var corsAttr = new EnableCorsAttribute("*", "*", "*");
 config.EnableCors(corsAttr);
</code></pre>

<p>Everything works fine for Http get request,but the same not for Http Post request.</p>

<p>Any help would be appreciable </p>

<p>Thanks in advance!</p>
