I started out with my application writing the config to the registry like I did years back with UAC wasn’t around.
Turned out this wasn’t a good idea so I moved to the app.config file and found that this is having issues as well with UAC.
The configuration I have for the application is machine specific; individual users do not have their own configuration and the rest of the apps including the service all drive off the single configuration file.
If I try updating this file in the program files\myapp folder it gets denied.
What is everyone else doing for a scenario like this where there needs to be a single configuration file?
I should also mention that this configuration needs to be updated from within my applications.
I would use the Common Application Data folder, this is where most new applications store data which works with UAC.
You can get this with the following code:
To view all options for special folders you can check this link:
http://msdn.microsoft.com/en-us/library/system.environment.specialfolder.aspx
The most common options would be the following:
Application Data – The directory that serves as a common repository for application-specific data for the current roaming user.
Common Application Data – The directory that serves as a common repository for application-specific data that is used by all users.
Local Application Data – The directory that serves as a common repository for application-specific data that is used by the current, non-roaming user.