Last post Sep 30, 2016 01:51 AM by Yohann Lu
Sep 29, 2016 02:58 PM|iperez_genius|LINK
I am trying to access a service that is on a different domain. I own both so any additional configuration is possible.
I am calling the service method via jquery, ajax. At the moment i have 401 (Unauthorized) however when i add
I get a different error
A wildcard '*' cannot be used in the 'Access-Control-Allow-Origin' header when the credentials flag is true. Origin
http://origindomain.com is therefore not allowed access. The credentials mode of an XMLHttpRequest is controlled by the withCredentials attribute.
I have no fix for either error.
Can someone advis0e? The service has basic authentication enabled.
Sep 29, 2016 03:33 PM|Siva Krishna Macha|LINK
Did you set this header somewhere in your code? `Access-Control-Allow-Origin`
If so Refer http://stackoverflow.com/a/19744754
Sep 30, 2016 01:51 AM|Yohann Lu|LINK
Hi Siva Krishna Macha,
As far as I know, Browser security prevents a web page from making AJAX requests to another domain. If you want to let other sites call your web API. You should enable CORS in your Web API application.
The following tutorial shows how to enable CORS in your Web API application.
Enabling Cross-Origin Requests in ASP.NET Web API 2: