System.Data.DataSet ds; //Fill dataset // Get a FileStream object using (System.IO.StreamWriter xmlDoc = new System.IO.StreamWriter(Server.MapPath("~/writeabledir/xmlDoc.xml"), false)) { // Apply the WriteXml method to write an XML document ds.WriteXml(xmlDoc); }