Writing xml to hdd

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

how can i accomplish this task? from the dataset, i wan to transform it into an xml file and store it in the application server.
 
private void WriteXmlToFile(DataSet thisDataSet) {
if (thisDataSet == null) { return; }
// Create a file name to write to.
string filename = "myXmlDoc.xml";
// Create the FileStream to write with.
System.IO.FileStream myFileStream = new System.IO.FileStream
(filename, System.IO.FileMode.Create);
// Create an XmlTextWriter with the fileStream.
System.Xml.XmlTextWriter myXmlWriter =
new System.Xml.XmlTextWriter(myFileStream,
System.Text.Encoding.Unicode);
// Write to the file with the WriteXml method.
thisDataSet.WriteXml(myXmlWriter);
myXmlWriter.Close();
}

hth,
Av.
 
Hi Asha,

The Asp.net account (the default is ASPNet) should have write permission on
the folder. change your NTFS folder permissions to include ASPNet user with
change permission.

Av.
 
Back
Top