I'm running asp.net c# and from the server I'm trying to get the status of an application running on the client using port 9192. To go about this I'm calling the below ajax get call. My clients are all vpn connected to the server so I'm using the vpn ip of the client
However I'm getting the below error from the console
XMLHttpRequest cannot load http://clientIP:9192/omxcmd?cmd=position. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://[my server name]:81' is therefore not allowed access.
I have tried a pure javascript call from here HTTP GET request in JavaScript?
with the same error I have also added the below in my web.config file which is supposed to give me the cross domain calls but this hasnt made a difference.
<httpProtocol>
<customHeaders>
<!-- Enable Cross Domain AJAX calls -->
<remove name="Access-Control-Allow-Origin" />
<add name="Access-Control-Allow-Origin" value="*" />
</customHeaders>
</httpProtocol>
the below is my ajax call from my aspx page
$.ajax({
url: "http://VPNIPofCLIENT:9192/omxcmd?cmd=position",
type: "GET",
crossDomain: true,
dataType: "json",
success: function (response) {
var resp = JSON.parse(response)
alert(resp.status);
},
error: function (xhr, status) {
alert("error");
}
});
I have also started the chromium browser on the client side with chromium-browser --disable-web-security with no joy
Using the "http://localhost:9192/omxcmd?cmd=position" is returning the correct string back so it is working