Access denied for xml load

Discussion in 'Javascript' started by sean, Mar 2, 2004.

  1. sean

    sean Guest

    var strPath = "c:\myXml.xml";

    var objDom = new ActiveXObject("Msxml2.DOMDocument");
    alert('step 1');
    objDom.load(strPath);
    alert('step 2');
    ................

    AFTER step 1 I'm getting an errorrrrrrrrrrrr. Im just going crazy.
    Error: Access denied!


    Yes, if I put strPath like : http://somehost/myXml.xml it is going to
    work.
    But I need the user to be able to pick up this xml with an <input
    type=file>.
    It won't be any upload, invloved, just read the damn path to the xml
    and load the xml. WHY is this happen?

    Thanks!
     
    sean, Mar 2, 2004
    #1
    1. Advertising

  2. sean

    Dag Sunde Guest

    Because JavaScript in a client-browser is running in
    a "sandbox", and won't let you out as long as you
    don't sign your scripts.

    objDom.load("C:\..."); are accessing the local file-system.
    Javascript are *only* allowed to access files on the
    server it originated.

    (And thank God for that!)


    If you really need this functionality, I would recommend
    that you contact Thawte or VeriSign to get yourself a
    Code Signing certificate, and convince your users to accept and
    install your certificate when they access your page.

    Signed Scripts *can* access local files.

    --
    Dag.


    "sean" <> wrote in message
    news:...
    > var strPath = "c:\myXml.xml";
    >
    > var objDom = new ActiveXObject("Msxml2.DOMDocument");
    > alert('step 1');
    > objDom.load(strPath);
    > alert('step 2');
    > ...............
    >
    > AFTER step 1 I'm getting an errorrrrrrrrrrrr. Im just going crazy.
    > Error: Access denied!
    >
    >
    > Yes, if I put strPath like : http://somehost/myXml.xml it is going to
    > work.
    > But I need the user to be able to pick up this xml with an <input
    > type=file>.
    > It won't be any upload, invloved, just read the damn path to the xml
    > and load the xml. WHY is this happen?
    >
    > Thanks!
     
    Dag Sunde, Mar 3, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?SnVzdGlu?=

    Access Denied following Assembly.Load

    =?Utf-8?B?SnVzdGlu?=, Oct 26, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    529
    =?Utf-8?B?SnVzdGlu?=
    Oct 26, 2005
  2. Ros@
    Replies:
    3
    Views:
    654
  3. Jay
    Replies:
    2
    Views:
    1,117
  4. Oliver
    Replies:
    0
    Views:
    156
    Oliver
    Sep 14, 2004
  5. Marc

    Security Access, Access Denied

    Marc, Aug 16, 2006, in forum: ASP .Net Security
    Replies:
    0
    Views:
    147
Loading...

Share This Page