Issue with ASP.NET Web API 2 and Ionic


#1

I have a web api written in ASP.NET. It runs fine when I submit requests from fiddler or from my angularjs web application. However, when I attempt to run it from ionic (using ionic serve) I am getting the following error:

Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.

I have confirmed that I have Cors enabled on the Web API and for simplicity I have it set to allow all origins. So I am a bit confused as to why my ionic application is having difficulties.

I have an authorization interceptor that is injecting the bearer information to requests and to analyze responses, but again, this is working fine when called from other clients.

Can anyone point me in the right direction? I have read a number of posts, but from what I have read it seems that since I have added the AllowAll for cors so that all origins are permitted, this shouldn’t be an issue.

Thanks!
Bob


#2

I was able to solve this easily by installing a plugin for chrome at this link: Allow-Control-Allow-Origin Chrome Plugin. Worked like a charm!