I have an IONIC/AngularJS application from which I have to call my ASP.NET MVC controller method i.e Login. It works with fine with $http.get() but when I use $http.post() or $http({method: 'POST'}) it returns an error. The error is (for Chrome):
Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource
I have enabled CORS for Server by following the answer to this question:
I also included nuget package to enable CORS, but this didn't solve my problem. I also tried adding the following in Angular's POST request:
$http({
method: 'POST',
url: url,
headers: {'Access-Control-Allow-Origin': '*'},
data: _data}).then();
but it didn't work either. Please let me know if I am missing something.
Thankx