I have a project with Angular Framework and Asp.net Core.
In my ConfigureServices I have bellow code:
services.AddCors(options =>
            {
                options.AddPolicy(
                    "CorsPolicy",
                    builder => builder
                        .AllowAnyOrigin()
                        .AllowAnyMethod()
                        .AllowAnyHeader()
                        .AllowCredentials());
            });
And un Configure as follow:
 app.UseCors("CorsPolicy");
 app.UseMvc();
And after that added EnbaleCors attribute in BaseApiController
[EnableCors("CorsPolicy")]
public class BaseApiController : Controller
In Angular added follow:
return this.http
        .post(url, body, { headers: headers, withCredentials: true })
        .map((response: Response) => {
            return response as any;
        })
When I run the application I have 2 requests in Network, One of them Request Method: OPTIONS with Status Code: 204 No Content and other in my request.
Where is my problem?
Thanks for taking the time and share your ideas
 
    