I have trying to build an angular app using ASP.NET MVC Web API.
When i make a $resource request to my web server (localhost) I get
XMLHttpRequest cannot load http://localhost:59636/api/studios. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:44060' is therefore not allowed access. The response had HTTP status code 401.
I read that installing Cors would solve this. But it doesnt. I have tried both enabling cors
config.EnableCors(new EnableCorsAttribute("*", "*", "*"));
as well as using an the attribute
[EnableCorsAttribute("*", "*", "*")]
It is working on IE
In your WebApiConfig.cs file you should have:
In your ApplicationOAuthProvider.cs, in GrantResourceOwnerCredentials():
And over the controller: