I have an API project in .net with MVC and another project in angular 7. When I try to call a method, the CORS issues occurred. The error message is shown below. Can anyone help to solve the issue? Thanks in Advance
Access to XMLHttpRequest at 'http://localhost:55134/UserDetails/GetUserDetails' from origin 'http://localhost:4200' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
I have already installed the package Microsoft.AspNet.WebApi.Cors
and added
EnableCorsAttribute cors = new EnableCorsAttribute("*","*","*");
config.EnableCors(cors);
in the WebApiConfig.cs
file.