Friday, 8 May 2015

Check or Create Xml file

 if (!File.Exists(Server.MapPath("first.xml")))
        {
            XmlTextWriter wrt = new XmlTextWriter(Server.MapPath("first.xml"), System.Text.Encoding.UTF8);
            wrt.WriteStartDocument(true);
            wrt.Formatting = Formatting.Indented;
            wrt.WriteStartElement("root");
            wrt.WriteEndElement();
            wrt.Close();
        }

No comments:

Post a Comment