No HTTP resource error when doing PUT/POST [CORS issue - AngularJS + Web API 2]
I had issues getting it to work with the the values in the config so I removed them from there and I added the following to my WebApiConfig class:
//Specify values as appropriate (origins,headers,methods) var cors = new EnableCorsAttribute("http://myurl","*","*"); config.EnableCors(cors);
You can find the nuget package for Microsoft ASP.NET Web API 2.2 Cross-Origin
from here
Besides the config option config.EnableCors();
in your Register
method you need to enable CORS in your controller by using [EnableCors] attribute along with the declaration of the controller, here is an example how I do it:
[EnableCors(origins: "http://localhost:49595", headers: "*", methods: "*")] public class ValuesController : ApiController { ...