简体   繁体   中英

How to load xml config file from another computer?

I have application c#, config file is xml file. If same computer it working is fine but not security. In this case, everyone can see and read this config file.

Can I load xml file from another computer?

XDocument doc = XDocument.Load(fileXml);
var cmds = doc.Root
              .Element("ListProfile")
              .Elements("Profile")
              .Where(b => b.Element("Id").Value == profile_id)
              .SelectMany(b => b.Element("Command").Elements())
              .Select(p => new
               {
                   Id = (int)p.Element("Id"),
                   Path = (string)p.Element("Path"),
                   Value = (string)p.Element("Value")
               });

Thanks.

Do you want to load your config when starting the application, or is it possible to load the config after the initial load is done. In the latter case, you would be better of using a webservice.

Also where is this second PC located? Is it inside the same LAN or somewhere else? Same as with the first point, the latter would make a webservice a better option.

Lastly, what is the security problem. If you are worried about passwords in the config, you could encrypt these passwords, and load the encrypted password from the XML, then just decrypt and see if it's correct.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM