Reputation: 7490
In my Web API
project I have enabled CORS globally by adding following line in WebApiConfig
config.EnableCors();
but it still give me error while I request service from other App Domain.
However it works fine if I apply [EnableCors("*", "*", "*")]
on controller level.
Why it doesn't work for application level?
Upvotes: 2
Views: 163
Reputation: 157078
If you want to define a global rule, you can pass that into EnableCors
:
EnableCorsAttribute cors = new EnableCorsAttribute("*", "*", "*");
config.EnableCors(cors);
By calling EnableCors
, you just enable the framework, nothing more.
Upvotes: 3