By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,401 Members | 1,381 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,401 IT Pros & Developers. It's quick & easy.

Trouble executing ActiveXObject from server

P: n/a
Don
I'm trying to run the following page on my desktop from my host
server. It works just fine if I run it from my desktop, but not if I
run it from the server. I get "Error: Permission denied" on the
"newActiveXObject" statement. I understand about the security issues
surrounding ActiveX, but since I'm not accessinig any client-side
files, I would think this should work. Any ideas would be
appreciated.

Thanks,
Don
<html>
<head>
<title>Test Script</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
</head>
<body>
<script type="text/javascript">
//
// Get CPC index page 1
//
var sCPCIndexPage1URL = "http://www.google.com";
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.open("Get",sCPCIndexPage1URL,false);
xmlhttp.send();
var sCPCIndexPage1HTML = xmlhttp.responseText;
//
// Display page
//
window.open("javascript:opener.sCPCIndexPage1HTML" );
</script>
</body>
</html>

-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Jul 23 '05 #1
Share this Question
Share on Google+
9 Replies


P: n/a


Don wrote:
I'm trying to run the following page on my desktop from my host
server. It works just fine if I run it from my desktop, but not if I
run it from the server. I get "Error: Permission denied" on the
"newActiveXObject" statement. I understand about the security issues
surrounding ActiveX, but since I'm not accessinig any client-side
files, I would think this should work. Any ideas would be var sCPCIndexPage1URL = "http://www.google.com";
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.open("Get",sCPCIndexPage1URL,false);


I don't think you get permission denied for ActiveXObject, you should
get it for the open call trying to open a connection to
http://www.google.com/ as that is something the same origin policy
doesn't allow.
It works with local files as there IE doesn't implement the same origin
policy.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #2

P: n/a
Don
On Wed, 22 Sep 2004 17:13:10 +0200, Martin Honnen <ma*******@yahoo.de>
wrote:


Don wrote:
I'm trying to run the following page on my desktop from my host
server. It works just fine if I run it from my desktop, but not if I
run it from the server. I get "Error: Permission denied" on the
"newActiveXObject" statement. I understand about the security issues
surrounding ActiveX, but since I'm not accessinig any client-side
files, I would think this should work. Any ideas would be

var sCPCIndexPage1URL = "http://www.google.com";
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.open("Get",sCPCIndexPage1URL,false);


I don't think you get permission denied for ActiveXObject, you should
get it for the open call trying to open a connection to
http://www.google.com/ as that is something the same origin policy
doesn't allow.
It works with local files as there IE doesn't implement the same origin
policy.

Hi Martin,

Any idea how I can do this?

Regards,
Don
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Jul 23 '05 #3

P: n/a


Don wrote:

[cross domain XML access]
Any idea how I can do this?


If it is just for your own purpose I think there is an IE preference you
can set on your IE browser, check the preferences, there should be
something like allow data access to sources from different domains.
If you want to do that in your web page when it is loaded in IE when
someone is visiting your site then that is not possible with client side
script, you would need server side scripting.
You can also try to write an HTML application (.hta file) if all you
want is implement the Google access for your own tests.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #4

P: n/a
Don
On Wed, 22 Sep 2004 17:44:23 +0200, Martin Honnen <ma*******@yahoo.de>
wrote:


Don wrote:

[cross domain XML access]
Any idea how I can do this?


If it is just for your own purpose I think there is an IE preference you
can set on your IE browser, check the preferences, there should be
something like allow data access to sources from different domains.
If you want to do that in your web page when it is loaded in IE when
someone is visiting your site then that is not possible with client side
script, you would need server side scripting.
You can also try to write an HTML application (.hta file) if all you
want is implement the Google access for your own tests.

My plan is to run the script on server side. I've tried it there, but
that's when I get the error. How can I run it on server side and not
get the error?

Don
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Jul 23 '05 #5

P: n/a


Don wrote:

[cross domain XML access]
My plan is to run the script on server side. I've tried it there, but
that's when I get the error. How can I run it on server side and not
get the error?


Do you have support for ASP scripting on your server? Otherwise you
can't run the code on the server.
On the server you should use code alike
<%@ Language="JScript" %>
<%
var httpRequest;
httpRequest = Server.CreateObject('Msxml2.ServerXMLHTTP.3.0');
httpRequest.open('GET', 'http://www.google.com/', false);
httpRequest.send(null);
Response.Write(Server.HTMLEncode(httpRequest.respo nseText));
%>

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #6

P: n/a
Don
On Fri, 24 Sep 2004 15:38:33 +0200, Martin Honnen <ma*******@yahoo.de>
wrote:


Don wrote:

[cross domain XML access]

My plan is to run the script on server side. I've tried it there, but
that's when I get the error. How can I run it on server side and not
get the error?


Do you have support for ASP scripting on your server? Otherwise you
can't run the code on the server.
On the server you should use code alike
<%@ Language="JScript" %>
<%
var httpRequest;
httpRequest = Server.CreateObject('Msxml2.ServerXMLHTTP.3.0');
httpRequest.open('GET', 'http://www.google.com/', false);
httpRequest.send(null);
Response.Write(Server.HTMLEncode(httpRequest.resp onseText));
%>


I'm going to run the script from the server, and not on the server.
It will be embedded in a web page, and be accessed by the client's
browser, like any other web site. It's just that when I run it from
the server I get that Error: Permission Denied.

Don
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Jul 23 '05 #7

P: n/a
In article <32********************************@4ax.com>,
Don <no@adr.com> wrote:
I'm going to run the script from the server, and not on the server.
It will be embedded in a web page, and be accessed by the client's
browser, like any other web site. It's just that when I run it from
the server I get that Error: Permission Denied.

Don


Because when you run a script from a server, the permissions get
lowered. If you want to take the risk on your machine, you can set the
permission lower.

You may also be able to change the file type to hta but this is a guess
because I am not knowledge about hta.

I assume you are using IE. I avoid using IE because I do not like its
security model.

What folks are saying is that if you want your web page to run on the
Internet on any browser, you need to move the functions that jump out of
your web page and interact with the native machine on to a server.

Robert
Jul 23 '05 #8

P: n/a


Don wrote:

[cross domain XML access]
I'm going to run the script from the server, and not on the server.
It will be embedded in a web page, and be accessed by the client's
browser, like any other web site. It's just that when I run it from
the server I get that Error: Permission Denied.


Yes, and I have explained that browsers implement a same origin policy
so your script loaded from http://host1.example.com/ can only use Msxml
to load data from that domain http://host1.example.com/ and not from
other domains.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #9

P: n/a
Don
On Sat, 25 Sep 2004 12:17:41 +0200, Martin Honnen <ma*******@yahoo.de>
wrote:


Don wrote:

>[cross domain XML access]

I'm going to run the script from the server, and not on the server.
It will be embedded in a web page, and be accessed by the client's
browser, like any other web site. It's just that when I run it from
the server I get that Error: Permission Denied.


Yes, and I have explained that browsers implement a same origin policy
so your script loaded from http://host1.example.com/ can only use Msxml
to load data from that domain http://host1.example.com/ and not from
other domains.

Hi Martin,

Thanks for that clarification. I think I understand now.

What construct would you recommend I use instead of Msxml?
Thanks, Don
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Jul 23 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.