How to write and save an XMl file in a Configured Location in C#



I have the below code to write an XML.But it stores inside the Bin folder after successful run. Question is:I want to store it in some specified Configurable Network location instead of Bin folder. Any idea?



XmlDocument doc = new XmlDocument();
doc.LoadXml("<item><name>wrench</name></item>");

// Add a price element.
XmlElement newElem = doc.CreateElement("price");
newElem.InnerText = "10.95";
doc.DocumentElement.AppendChild(newElem);

XmlWriterSettings settings = new XmlWriterSettings();
settings.Indent = true;
// Save the document to a file and auto-indent the output.
XmlWriter writer = XmlWriter.Create("data.xml", settings);
doc.Save(writer);


Thanks


No comments:

Post a Comment