I have found that installing this package: https://www.nuget.org/packages/Microsoft.AspNet.WebApi.Cors should be a solution but it isn't possible because Umbraco uses Microsoft.AspNet.WebApi Version 4.. and this isn't compatible with the earliest version of Microsoft.AspNet.WebApi.Cors.
Any suggestions on how you got CORS working?
Am I missing something or?
I placed the Angular code in the same project so it runs on the same localhost. Now the API and Angular are running on the same host so there are no longer CORS isssues
Issue with CORS when posting to web api
Hello,
I have a project that runs on Umbraco 7.1.1 and I want to post an object to a webapi in the project.
The action is located on /umbraco/api/dummyapi/getsearchcontent with the following code
But when I post my object from Angular I get "XMLHttpRequest cannot load *. Invalid HTTP status code 405". The Angular code isn't in the same project.
Search results on Google tell me that this is an issue with CORS so I have tried different things like:
I have found that installing this package: https://www.nuget.org/packages/Microsoft.AspNet.WebApi.Cors should be a solution but it isn't possible because Umbraco uses Microsoft.AspNet.WebApi Version 4.. and this isn't compatible with the earliest version of Microsoft.AspNet.WebApi.Cors.
Any suggestions on how you got CORS working? Am I missing something or?
Hi I have the same issue, did you solve it ?
No I did not solve it but I worked around it.
I placed the Angular code in the same project so it runs on the same localhost. Now the API and Angular are running on the same host so there are no longer CORS isssues
I my case I solve it it in 2 step, add in web.config
Other problem is avoid send authorization header in angular request
Thanks Yakov Lebski for the solution.
It works for me for simple ajax post.
Regards,
Urvish Mandaliya
is working on a reply...