Some times I am getting error like:\[quote\] "The process cannot access the file '\192.168.0.100\SharedTemp\wer\abc\1\0960fd1e-68d4-48d7-8376-1c8c55e58c98\KeyImageSection\Section 1\Order.xml' because it is being used by another process."\[/quote\]How can avoid this issue?\[code\]try{ filename = filename + "\\Order.xml"; if (!ItemEntryExist(filename, instanceUID, orderNo)) { XmlProcessingInstruction xmlprocessingInstruct; XmlDocument xmlDoc = new XmlDocument(); XmlNode xmlroot = null; XmlNode DCMNode = null; XmlNode InstanceUIDNode = null; XmlNode OrderNoNode = null; //Create the Standard xml tag FileInfo fs = new FileInfo(filename); if (orderNo <= 1) { if (fs.Exists) { fs.Delete(); fs = null; fs = new FileInfo(filename); } } if (fs.Exists) { xmlDoc.Load(filename); LogManager.WriteToLog("WriteXMLDoc : Loading Order.xml...", LogLevel.Information); } else { LogManager.WriteToLog("WriteXMLDoc : Creating Order.xml...", LogLevel.Information); xmlprocessingInstruct = xmlDoc.CreateProcessingInstruction("xml", "version='1.0' encoding='UTF-8'"); xmlDoc.AppendChild(xmlprocessingInstruct); xmlprocessingInstruct = null; //Create the root node - DCMS xmlroot = xmlDoc.CreateElement("DCMS"); xmlDoc.AppendChild(xmlroot); } xmlroot = xmlDoc.SelectSingleNode("DCMS"); DCMNode = xmlDoc.CreateElement("DCM"); xmlroot.AppendChild(DCMNode); InstanceUIDNode = xmlDoc.CreateElement("InstanceUID"); InstanceUIDNode.InnerText = instanceUID; DCMNode.AppendChild(InstanceUIDNode); OrderNoNode = xmlDoc.CreateElement("OrderNo"); OrderNoNode.InnerText = orderNo.ToString(); DCMNode.AppendChild(OrderNoNode); string parentDirectory = Path.GetDirectoryName(filename); if (!Directory.Exists(parentDirectory)) Directory.CreateDirectory(parentDirectory); CheckIfFileIsBeingUsed(filename); xmlDoc.Save(filename); OrderNoNode = null; InstanceUIDNode = null; DCMNode = null; xmlroot = null; xmlDoc = null; }}catch (Exception ex) { }\[/code\]