Access denied writing XML file from Javascript 
Author Message
 Access denied writing XML file from Javascript

Help,

I am trying to update an XML file from my Browser (IE5).
I access the file via the DOM in javascript, modify it and write it
back. The write fails with an
access denied error.

I assume that I am running into a securtiy problem or am I completely on
the wrong track.

Any ideas appreciated.

Thanks
Joe

<SCRIPT LANGUAGE="JavaScript">
 function Save(){
  var xmlDoc = new ActiveXObject("microsoft.xmldom");
  xmlDoc.load("test.xml");
  xmlDoc.documentElement.childNodes.item(0).text="test";
  // Following line => Access Denied
  xmlDoc.save("test.xml");
 }
</SCRIPT>



Mon, 01 Apr 2002 03:00:00 GMT  
 Access denied writing XML file from Javascript
Exactly right. You could set your own browser security to none, and it would function, but, of course, that's not what you want. If you operate from the server side, with execute permissions, you get what you want. Clients don't allow this, for obvious reasons.

Locally, the Windows Script Host, a kind of securityless script engine is great for xml data manipulation.

--
mvp Mark L. Ferguson Please reply in newsgroup
marfers notes for OE 5 > (16K) http://www.geocities.com/SiliconValley/Bay/6386/IE_ng_notes.htm

Quote:

> Help,

> I am trying to update an XML file from my Browser (IE5).
> I access the file via the DOM in javascript, modify it and write it
> back. The write fails with an
> access denied error.

> I assume that I am running into a securtiy problem or am I completely on
> the wrong track.

> Any ideas appreciated.

> Thanks
> Joe

> <SCRIPT LANGUAGE="JavaScript">
>  function Save(){
>   var xmlDoc = new ActiveXObject("microsoft.xmldom");
>   xmlDoc.load("test.xml");
>   xmlDoc.documentElement.childNodes.item(0).text="test";
>   // Following line => Access Denied
>   xmlDoc.save("test.xml");
>  }
> </SCRIPT>



Mon, 01 Apr 2002 03:00:00 GMT  
 Access denied writing XML file from Javascript
Hallo Mark,

Thanks for your reply.

I did try setting my browser security to none but I still got an access denied error. Looking through the newsgroup I saw messages which state that the .save() method is disabled in the browser, in my case IE5. I assume therefore that regardless of my security
settings I cannot save an XML file in the browser.

I am now exploring the approach of getting the Web Server to save the file generated on the client via calls to the ActiveX Control "Microsoft.XMLHTTP". This makes my solution much more complicated than I originally intended though.

If there is a way to configure IE5 security settings in order to save an XML file in the browser, please let me know how.

Joe Hennessy


Quote:
> Exactly right. You could set your own browser security to none, and it would function, but, of course, that's not what you want. If you operate from the server side, with execute permissions, you get what you want. Clients don't allow this, for obvious reasons.

> Locally, the Windows Script Host, a kind of securityless script engine is great for xml data manipulation.

> --
> mvp Mark L. Ferguson Please reply in newsgroup
> marfers notes for OE 5 > (16K) http://www.geocities.com/SiliconValley/Bay/6386/IE_ng_notes.htm


> > Help,

> > I am trying to update an XML file from my Browser (IE5).
> > I access the file via the DOM in javascript, modify it and write it
> > back. The write fails with an
> > access denied error.

> > I assume that I am running into a securtiy problem or am I completely on
> > the wrong track.

> > Any ideas appreciated.

> > Thanks
> > Joe

> > <SCRIPT LANGUAGE="JavaScript">
> >  function Save(){
> >   var xmlDoc = new ActiveXObject("microsoft.xmldom");
> >   xmlDoc.load("test.xml");
> >   xmlDoc.documentElement.childNodes.item(0).text="test";
> >   // Following line => Access Denied
> >   xmlDoc.save("test.xml");
> >  }
> > </SCRIPT>



Tue, 02 Apr 2002 03:00:00 GMT  
 Access denied writing XML file from Javascript
with security at none:

<html>
<body>
<script>
Sub OpenTextFileTest
  Const ForReading = 1, ForWriting = 2, ForAppending = 8
  Dim fso, f
  Set fso = CreateObject("Scripting.FileSystemObject")
  Set f = fso.OpenTextFile("c:\testfile.txt", ForWriting, True)
  f.Write "Hello world!"
  f.Close
End Sub
</script>
</body>
<html>

--
mvp Mark L. Ferguson Please reply in newsgroup
marfers notes for OE 5 > (17K) http://www.geocities.com/SiliconValley/Bay/6386/IE_ng_notes.htm

Quote:

> Hallo Mark,

> Thanks for your reply.

> I did try setting my browser security to none but I still got an access denied error. Looking through the newsgroup I saw messages which state that the .save() method is disabled in the browser, in my case IE5. I assume therefore that regardless of my security
> settings I cannot save an XML file in the browser.

> I am now exploring the approach of getting the Web Server to save the file generated on the client via calls to the ActiveX Control "Microsoft.XMLHTTP". This makes my solution much more complicated than I originally intended though.

> If there is a way to configure IE5 security settings in order to save an XML file in the browser, please let me know how.

> Joe Hennessy


> > Exactly right. You could set your own browser security to none, and it would function, but, of course, that's not what you want. If you operate from the server side, with execute permissions, you get what you want. Clients don't allow this, for obvious reasons.

> > Locally, the Windows Script Host, a kind of securityless script engine is great for xml data manipulation.

> > --
> > mvp Mark L. Ferguson Please reply in newsgroup
> > marfers notes for OE 5 > (16K) http://www.geocities.com/SiliconValley/Bay/6386/IE_ng_notes.htm


> > > Help,

> > > I am trying to update an XML file from my Browser (IE5).
> > > I access the file via the DOM in javascript, modify it and write it
> > > back. The write fails with an
> > > access denied error.

> > > I assume that I am running into a securtiy problem or am I completely on
> > > the wrong track.

> > > Any ideas appreciated.

> > > Thanks
> > > Joe

> > > <SCRIPT LANGUAGE="JavaScript">
> > >  function Save(){
> > >   var xmlDoc = new ActiveXObject("microsoft.xmldom");
> > >   xmlDoc.load("test.xml");
> > >   xmlDoc.documentElement.childNodes.item(0).text="test";
> > >   // Following line => Access Denied
> > >   xmlDoc.save("test.xml");
> > >  }
> > > </SCRIPT>



Tue, 02 Apr 2002 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Access is denied (JavaScript error) while writing to the stream

2. Access denied (JavaScript error) while download a file.

3. Dynamically writing XML from javascript

4. Access Denied--Document.Write

5. IE 5.5 - access denied on document.write()

6. Acess Denied in writing to a text file

7. Access denied when I try to launch an exe file

8. access denied when trying to copy a file

9. access to specified device or file is denied

10. Access denied once the file field is filled

11. type=file access denied

12. "Access denied" when accessing script object

 

 
Powered by phpBB® Forum Software