Answer the question
In order to leave comments, you need to log in
How to allow connection to local angular access to web api, cors policy from browser?
Can't send request to web api. Both projects are local. I am accessing the web api:
return this.http.post('https://localhost:44375/api/ApplicationUser/Register', body);
app.UseCors(builder => builder.WithOrigins("http://localhost:4200").AllowAnyHeader().AllowAnyMethod());
Access to XMLHttpRequest at 'https://localhost:44375/api/ApplicationUser/Register' from origin 'http://localhost:4200' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
POST https://localhost:44375/api/ApplicationUser/Register net::ERR_FAILED
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question