0

var xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP"); xmlHttpRequest.open("POST", "http://vat/_vti_bin/lists.asmx", false);

How can I let this script work on a Terminal server? When I open it on my local pc, it works, but when I do the same thing in a browser on a Terminal server, I get Access Denied.

I tried using ServerXMLHTTP, but then i get Cannot create automation object

seva titov
  • 11,720
  • 2
  • 35
  • 54
Jeroen
  • 1
  • 2

1 Answers1

0

Is vat your local pc or the terminal server? I'm guessing it's your local pc, which means you'll be limited by the Same Origin Policy - this means you can only make a request from the same server the page is being served from.

You can get around this using JSONP, which - in a nutshell - loads the ajax as a script tag with a js callback.

Or just move your ajax feed onto your web server.

Adam Hopkinson
  • 28,281
  • 7
  • 65
  • 99
  • VAT is the server ( cit-srv-004.Converge-IT.local is dns name ). Dns name Terminal server is ( cit-srv-003.Converge-IT.local ). But it works in my browser on local pc, I get access denied when I do the same in the browser on Terminal server desktop. – Jeroen Mar 31 '10 at 10:09
  • Change your request to point to `/_vti_bin/lists.asmx` (ie no hostname) – Adam Hopkinson Mar 31 '10 at 10:17
  • That might be, but that's the problem. Your request needs to originate from the same hostname as the website, or it will be restricted by SOP. – Adam Hopkinson Mar 31 '10 at 13:29
  • But why don't I have that problem when I do this from a browser on my local pc, I'm calling a script from http:/crm/ and I post data to http:/vat/_vti_bin/lists.asmx – Jeroen Mar 31 '10 at 13:44
  • Could you just try it and see? – Adam Hopkinson Mar 31 '10 at 15:00
  • Changed my request to point to /_vti_bin/lists.asmx. I get statuscode 500 or Internal Server Error. Now it goes to http:/crm/../_vti_bin/lists.asmx, but I need to go to http:/vat/vti_bin/lists.asmx. – Jeroen Apr 01 '10 at 07:18