I have the following problem trying to use a custom configuration section in my app.config. I use a custom configuration section to track the selection of folders that I want to create using my program:
<CustomConfigSection>
<BackupLocations>
<clear />
<add path="C:\Users\Marcel\Documents\" />
</BackupLocations>
</CustomConfigSection>
Now, when I save the configuration file, I get this exception:
System.Configuration.ConfigurationErrorsException: an error occurred loading the configuration file: access to the path C: \ Program Files (x86) \ Backup solutions \ uqhuxi1j.tmp deprived. (C: \ Program Files (x86) \ Backup Solutions \ BS.exe.Config) ---> System.UnauthorizedAccessException
Code I use:
Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
CustomConfigSection section = (CustomConfigSection)config.GetSection("CustomConfigSection");
section.BackupLocations.Add(element);
section.SectionInformation.ForceSave = true;
config.Save(ConfigurationSaveMode.Full);
, , , UAC/. , .
:
AppData, Custom Config ApplicationFolder/exe.config? AppData?
. ? , AppData. , . !
, .