1
I have an Angularjs application that logs in. I am trying after logging in, requesting an API that I am running on my machine running in C# to at least be able to communicate with it. But it made several mistakes in my attempt, since
$http.get('http://localhost:5001/Login').then(function(data){
console.log('entrou algo');
}, function(data){ console.log(data); });
Error 1: Blocked cross source request: Same source policy does not allow reading the remote resource at http://localhost:5001/Login. (Reason: the CORS application was unsuccessful)
$http({method:'GET',
url: 'https://localhost:5001',
headers: 'Access-Control-Allow-Origin: *'
}).then(function(data){
return data;
});
Erro2: Blocked cross source request: Same source policy does not allow reading the remote resource in https://localhost:5001/. (Reason: CORS header 'Access-Control-Allow-Origin' missing).
Someone could help me?
you have to configure the service to accept and release the
cors
!– novic
I tried to put in index.php, in . htacess and still by the request and still continues with the error. I don’t know if I did right too...
– Hollyfighter
what if there is index.php with C#?
– novic