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
ca*************@tornadosoftware.net