1

I am doing research in order to build a proof of concept build for a program that currently uses an ini file for its configuration settings. This change is being considered because currently the ini file is stored in the program's installation directory. The proof of concept is to migrate the ini file into a user configuration file.

This migration alone would not be a concern but the platform we support is also going to migrate to Windows 7. The current system uses Windows XP and uses a write protection system to avoid changes to the system. My concern is that the user configuration file in the default location on Windows 7 will be placed in a folder that will be write protected. This means if the user had to reboot the system ( unlikely given the context this system is even used ) the most recent changes to the configuration file would be lost.

My current thought is to create a custom user configuration file in the same directory we are moving other user create files to. This will allow us to tell the system configuration manager which directories to allow to be change.

I found the following question: How to write to the main exe's .config userSettings section?

My only question based on the accepted answer of the reference question, will I be able to load a custom configuration file, and easily access the Properties ( this is in reference to System.Properties.Default.SomeApplicationSettingName ) of the configuration file?

The only thing I am concerned about is that the user configuration file's default location is hard to locate by a novice computer user. Since the only easily located .NET configuration file is located ( by default ) in the same directory as the executable a given user's ability to modify that file will be in question.

Since this is a proof on concept I have the ability to use .NET Framework 4.0 solutions. One requirement that cannot be lifted is the use of external third-party libraries.

Community
  • 1
  • 1
Security Hound
  • 2,577
  • 3
  • 25
  • 42

3 Answers3

1

Consider using User settings. You can read, write, modify them appropriately and they are saved in the correct location that has write permissions

parapura rajkumar
  • 24,045
  • 1
  • 55
  • 85
0

If you're simply looking for User settings vs. Application settings, this is already built into the .NET Framework.

Using Settings in C#

jrummell
  • 42,637
  • 17
  • 112
  • 171
0

Configuration Settings and File System Access rights / security are 2 totally different things. Having a configuration file won't affect what you were stating in your last statement in regards to "Introduce unacceptable issues" that would be a network admin issues at that point if folders or shares have not been setup correctly. Also you can still use conventional .INI file in C# I have done it many many times before but that defeats the purpose of having an app.config file

I don't mean to sound rude.. but are you truly familiar of the wonders / magic that you can do with a .config file..? you should not have to worry about finding the location of the .config file also the app.config file that you use during development/ debugging / coding is different that the actual one that the application will reference / consume. keep that in mind as well

MethodMan
  • 18,625
  • 6
  • 34
  • 52