I am under the impression that .NET programs (C# with VisualStudio 2008) always compile to an executable (programname.exe) and a settings file (programname.exe.config). Sometimes there is more to a program, but these two persist. They end up being in the same directory.
I logged on to a WinXP Prof as Admin and installed a .NET program. This program allows to store some data in its programname.exe.config file, which resides in %PROGRAMFILESFOLDER%/Programname/ anlongside with programname.exe.
I ran the program, it worked as expected. Then I logged out and back on as restricted user. The program still worked like a charm.
If I understand correctly, changing and saving in Settings.Default.* is achieved by changing programname.exe.config. How can it be that restricted user is allowed to do so? He's not allowed to change any file through notepad.
And, will this stay possible in Windows Vista and 7?
Or will I have to re-direct the settings file somehow to some %APPSETTINGS% directory for those?
1. Application settings are the same for all users, and they cannot be changed by the app itself. Those are stored in the appname.exe.config file. You can edit the file with e.g. WordPad, other than that the information could as well have been stored inside the exe file itself.
2. User settings are individual, they can be changed by the app itself. Those are stored twice: the default value is present in the appname.exe.config file (just like app settings), and it is read-only; the actual value chosen by the user however is stored in a similar file (named user.config) in a subfolder of the user's personal folder (that is under Documents and Settings on older Windows versions, and under Users since Vista).
So file appname.exe.config can be write protected, no problem; the user's folders should be (and normally are) fully accessible by their owner.
It is of course explained in the MSDN documentation, starting here[^].