Cross-domain calls from client code in all major browsers do not matter. You can either
- Use CORS i.e. set the
Access-Control-Allow-Origin header to http://your-caller-domain.com in the web service response to allow requests coming from your siteβs domain. - Use JSONP Technique
- Create your own proxy API in your application (using a regular ASP.NET MVC controller or WebAPI ) that will make a server-side call using the
WebClient class and return a response to you.
Parameters are ordered from best to worst. CORS is supported by most browsers, with the exception of IE8 / 9 (which have partial support through XDomainRequest ) and later. There are workarounds for this.
Please note that the first two are related to the changes on the side of the web service - if you cannot do this, option 3. remains the only one.
source share