I'm getting below error on calling API from ASP.Net MVC in angular version 1
Error:
Access to XMLHttpRequest at 'URL 1' from origin 'URL 2' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status.
I use below code in WebApiConfig:
var corsAttr = new EnableCorsAttribute("*","*","*");
config.EnableCors(corsAttr);
After that I tried to use below code :
var corsAttr = new EnableCorsAttribute("*","Content-Type", "GET,POST,PUT,DELETE,OPTIONS");
config.EnableCors(corsAttr);
and:
var corsAttr = new EnableCorsAttribute("https://rushpeik.ir","Content-Type", "GET,POST,PUT,DELETE,OPTIONS");
config.EnableCors(corsAttr);
But the problem remains