Reputation: 13
XmlDocument xd = new XmlDocument();
XmlDeclaration xmldecl = xd.CreateXmlDeclaration("1.0", null, null);
xd.AppendChild(xmldecl);
XmlElement xe = xd.CreateElement("root");
xd.AppendChild(xe);
xd.Save(@"C:\Windows\Config.xml");
I want to create an XML file in this director, but in fact it saves it in this place
C:\Users\wjl\AppData\Local\VirtualStore\Windows
Upvotes: 1
Views: 393
Reputation: 47068
This is a feature of Windows UAC, when you don't have permission to write in the Windows folder it is written in your VirtualStore instead.
Run your application as administrator an it should write to the real windows folder instead.
You can read more about UAC virtualization on technet.
Upvotes: 1