1
Reply

writing to xml

paddylast

paddylast

Dec 10 2004 11:33 AM
2.3k
I have a text file and an xml file in c:\mcad which is open to everyone. I can write to the text file with the code below but get access denied to the xml. public void Page_Load(object sender, System.EventArgs e) { StreamWriter sw = new StreamWriter(@"c:/mcad/audit.txt"); sw.WriteLine("\n"+"col3"+"\t"+"col4"); sw.Close(); //write to xml XmlTextWriter xr = new XmlTextWriter(@"c:/mcad/XMLFile1.xml",null); xr.WriteStartDocument(); xr.WriteStartElement("Product"); xr.WriteElementString("Name","Jack"); xr.WriteElementString("Address","Jack"); xr.WriteElementString("Address2","Jack"); xr.WriteElementString("Email","Jack"); xr.WriteEndElement(); xr.Flush(); xr.Close(); } Any help appreciated. Thanks

Answers (1)