Re: XMLDocument 'Save' Method fails with 'Permission Denied'
From: Joey Calisay (joeycalisay_at_yahoo.com)
Date: 09/16/04
- Next message: Sorawit Sharp: "Handling KeyPress when IsMdiContainer = true"
- Previous message: Joey Calisay: "Re: Reading result from MessageBox"
- In reply to: Carl Williams: "XMLDocument 'Save' Method fails with 'Permission Denied'"
- Next in thread: Carl Williams: "Re: XMLDocument 'Save' Method fails with 'Permission Denied'"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 16 Sep 2004 23:32:50 +0800
Their suggestion is correct, "serialization" security permission should be
enabled for that context. It is needed since the streamreader I believe
demands for this permission to be able to deserialize whatever is in your
xml be it in soap or binary format
"Carl Williams" <carl.e.williams@tornadosoftware.net> wrote in message
news:cc4be67a.0409160722.9110cf8@posting.google.com...
> Hope someone can help with this...
>
> I have looked at all the newsgroup articles and put into practice all
> the suggestions but to no good. I am pretty new to CSharp and .Net so
> any help would be greatly appreciated.
>
> I have an .ASPX.CS in which I am trying to open an XML file (which
> already contains content), making some alterations to the XML obtained
> from the file, and then trying to 'Save' the XML back to the file. I
> am using a StreamReader object to obtain the XML string from the file,
> I then load the XML into an XMLDocument object to make the necessary
> changes to the data within the XML. Once that operation is complete I
> open a further XMLDocument and load in the altered XML. I then try to
> perform a 'Save' operation back to the originating XML file, but it
> fails saying 'Access to [XML File Path] is denied'. The File is
> opened and saved using HttpContext.Current.Server.MapPath()
>
> I have made sure that ASP.NET has the required permissions on the
> file, and I know this works as I can write the file back with a
> different filename. Some suggestions on the groups have said to use
> 'serialization'. To essentially 'serialize' the XML file contents to
> an object, make changes to the objects data, and then 'de-serialize'
> it to persist it back to the XML file.
>
> Can anyone offer a simple example to do this, and explain why it has
> to be this way in order to be able to open, process, and save back an
> XML file?
>
> I have tried moving the location of the file to differing folders, and
> have tried different names etc.
>
> Many Thanks in advance.
>
> Carl Williams
> carl.e.williams@tornadosoftware.net
- Next message: Sorawit Sharp: "Handling KeyPress when IsMdiContainer = true"
- Previous message: Joey Calisay: "Re: Reading result from MessageBox"
- In reply to: Carl Williams: "XMLDocument 'Save' Method fails with 'Permission Denied'"
- Next in thread: Carl Williams: "Re: XMLDocument 'Save' Method fails with 'Permission Denied'"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|