I have an config file(.exe) present inside another folder in my application. When I run my application I want to open the file and then edit some changes inside appsetting. I am able to get the path of the .exe file using
string directory1 =
System.IO.Directory.GetParent(Environment.CurrentDirectory).ToString();
string directory2 = @"DualPort\SGPMService.UI.exe";
string path1 = Path.Combine(directory1, directory2);
Now I am unable to load the config file. I tried using xmldocument and filestream both.
XmlDocument d = new XmlDocument();
d.Load(path1);
FileStream fileStream = new FileStream(path1, FileMode.Open);
What would be the correct way to load the file and edit the changes ?