Last post Mar 04, 2013 09:15 AM by kidshaw
Mar 04, 2013 01:18 AM|spriyanair|LINK
string strMyXml = "<Employee>" +
"<firstName>" + textBox1.Text + "</firstName>" +
"<lastName>" + textBox2.Text + "</lastName>" +
XmlDocument xDoc = new XmlDocument();
//Here the xml is prepared and loaded in xml DOM.
I need to create an xml file dynamically on server in windows application.I have tried server.mappath but its showing error like name doesnt exist in current context
Mar 04, 2013 06:39 AM|ramanselva|LINK
For Windows Application You could use as given
AppDomain.CurrentDomain.BaseDirectory + "myNewXmlPerson.xml"
Mar 04, 2013 09:15 AM|kidshaw|LINK
Depending how you want to use it, you should use the special folder enumeration:
This is windows version independent, more details here : http://msdn.microsoft.com/en-gb/library/system.environment.specialfolder.aspx
Remember that the user of the application will need permissions to the location, so opt for MyDocuments or Desktop if you can. If you just want to store temporarily then use the application data directories - the user doesn't normally see these locations.
Hope that helps.