MCanSener
MCanSener

Reputation: 53

Save generated XML file

I am trying to do pretty basic XML save I did it before but somehow I am having trouble with an error.

Error:

System.NotSupportedException.

Code :

XmlDocument xdoc = new XmlDocument();
xdoc.LoadXml(txtXmlControl.Text);
xdoc.Save(Server.MapPath("~/App_Code/controls" + DateTime.Now+".txt"));//error

xdoc.LoadXml(txtXmlProcess.Text);
xdoc.Save("~/App_Code/processes" + DateTime.Now + ".xml");//error

Basically both save trials are giving me same error.

Upvotes: 0

Views: 316

Answers (2)

Damith
Damith

Reputation: 63105

xdoc.Save(Server.MapPath("~/App_Code/processes" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".xml"));

Upvotes: 0

MCanSener
MCanSener

Reputation: 53

I have just figured out that datetime.now makes the save name inappropriate for save. I changed it and solved the problem.. Thanks anyway..

Upvotes: 3

Related Questions