when save xml error occur as it is being used by another process.
XmlDocument XDOC = new XmlDocument();
XDOC.Load(System.Web.HttpContext.Current.Server.MapPath("~/XmlFiles/Blog.xml"));
XmlNode RootNode = XDOC.SelectSingleNode("//Blogs");
XmlNode childnode = XDOC.SelectSingleNode("/Blogs/IDs");
//check whether childnode exist or not.
if (childnode != null)
childnode.ParentNode.RemoveChild(childnode);
XmlElement XEle = XDOC.CreateElement("IDs");
XEle.SetAttribute("id", Convert.ToString(ID));
RootNode.AppendChild(XEle);
XDOC.Save(System.Web.HttpContext.Current.Server.MapPath("~/XmlFiles/Blog.xml"));(here getting error)
10 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Nitin SontakkePosted Aug 3, 2016, 4:43 AM
Sourabh ChoubeyPosted Aug 3, 2016, 4:26 AM
Nitin SontakkePosted Aug 3, 2016, 3:56 AM
Sourabh ChoubeyPosted Aug 3, 2016, 3:41 AM
Nitin SontakkePosted Aug 3, 2016, 3:35 AM
Sourabh ChoubeyPosted Aug 3, 2016, 3:28 AM
Vinay SinghPosted Aug 3, 2016, 3:19 AM
Sourabh ChoubeyPosted Aug 3, 2016, 3:15 AM
Vishal JadavPosted Aug 3, 2016, 3:12 AM
Nitin SontakkePosted Aug 3, 2016, 3:12 AM