Trouble executing ActiveXObject from server

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Don

    Trouble executing ActiveXObject from server

    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
    "newActiveXObje ct" 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 sCPCIndexPage1U RL = "http://www.google.com" ;
    var xmlhttp = new ActiveXObject(" Microsoft.XMLHT TP");
    xmlhttp.open("G et",sCPCIndexPa ge1URL,false);
    xmlhttp.send();
    var sCPCIndexPage1H TML = xmlhttp.respons eText;
    //
    // Display page
    //
    window.open("ja vascript:opener .sCPCIndexPage1 HTML");
    </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! =-----
  • Martin Honnen

    #2
    Re: Trouble executing ActiveXObject from server



    Don wrote:
    [color=blue]
    > 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
    > "newActiveXObje ct" 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[/color]
    [color=blue]
    > var sCPCIndexPage1U RL = "http://www.google.com" ;
    > var xmlhttp = new ActiveXObject(" Microsoft.XMLHT TP");
    > xmlhttp.open("G et",sCPCIndexPa ge1URL,false);[/color]

    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

    Comment

    • Don

      #3
      Re: Trouble executing ActiveXObject from server

      On Wed, 22 Sep 2004 17:13:10 +0200, Martin Honnen <mahotrash@yaho o.de>
      wrote:
      [color=blue]
      >
      >
      >Don wrote:
      >[color=green]
      >> 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
      >> "newActiveXObje ct" 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[/color]
      >[color=green]
      >> var sCPCIndexPage1U RL = "http://www.google.com" ;
      >> var xmlhttp = new ActiveXObject(" Microsoft.XMLHT TP");
      >> xmlhttp.open("G et",sCPCIndexPa ge1URL,false);[/color]
      >
      >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.[/color]
      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! =-----

      Comment

      • Martin Honnen

        #4
        Re: Trouble executing ActiveXObject from server



        Don wrote:

        [cross domain XML access][color=blue]
        > Any idea how I can do this?[/color]

        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

        Comment

        • Don

          #5
          Re: Trouble executing ActiveXObject from server

          On Wed, 22 Sep 2004 17:44:23 +0200, Martin Honnen <mahotrash@yaho o.de>
          wrote:
          [color=blue]
          >
          >
          >Don wrote:
          >
          >[cross domain XML access][color=green]
          >> Any idea how I can do this?[/color]
          >
          >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.[/color]
          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! =-----

          Comment

          • Martin Honnen

            #6
            Re: Trouble executing ActiveXObject from server



            Don wrote:

            [color=blue][color=green]
            >>[cross domain XML access][/color][/color]
            [color=blue]
            > 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?[/color]

            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="JScri pt" %>
            <%
            var httpRequest;
            httpRequest = Server.CreateOb ject('Msxml2.Se rverXMLHTTP.3.0 ');
            httpRequest.ope n('GET', 'http://www.google.com/', false);
            httpRequest.sen d(null);
            Response.Write( Server.HTMLEnco de(httpRequest. responseText));
            %>

            --

            Martin Honnen

            Comment

            • Don

              #7
              Re: Trouble executing ActiveXObject from server

              On Fri, 24 Sep 2004 15:38:33 +0200, Martin Honnen <mahotrash@yaho o.de>
              wrote:
              [color=blue]
              >
              >
              >Don wrote:
              >
              >[color=green][color=darkred]
              >>>[cross domain XML access][/color][/color]
              >[color=green]
              >> 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?[/color]
              >
              >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="JScri pt" %>
              ><%
              >var httpRequest;
              >httpRequest = Server.CreateOb ject('Msxml2.Se rverXMLHTTP.3.0 ');
              >httpRequest.op en('GET', 'http://www.google.com/', false);
              >httpRequest.se nd(null);
              >Response.Write (Server.HTMLEnc ode(httpRequest .responseText)) ;
              >%>[/color]

              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! =-----

              Comment

              • Robert

                #8
                Re: Trouble executing ActiveXObject from server

                In article <32a9l0pen0q1he v142ocl6rmia85r djbe2@4ax.com>,
                Don <no@adr.com> wrote:
                [color=blue]
                > 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[/color]

                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

                Comment

                • Martin Honnen

                  #9
                  Re: Trouble executing ActiveXObject from server



                  Don wrote:

                  [color=blue][color=green][color=darkred]
                  >>>>[cross domain XML access][/color][/color][/color]
                  [color=blue]
                  > 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.[/color]

                  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

                  Comment

                  • Don

                    #10
                    Re: Trouble executing ActiveXObject from server

                    On Sat, 25 Sep 2004 12:17:41 +0200, Martin Honnen <mahotrash@yaho o.de>
                    wrote:
                    [color=blue]
                    >
                    >
                    >Don wrote:
                    >
                    >[color=green][color=darkred]
                    >>>>>[cross domain XML access][/color][/color]
                    >[color=green]
                    >> 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.[/color]
                    >
                    >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.[/color]
                    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! =-----

                    Comment

                    Working...