Best places to put user/application settings? Confused!

R

Robin Tucker

I'm a bit confused about where to put my program settings.

Firstly, I can choose (I suppose) between .ini, .xml or the registry. Which
one is best?

Secondly, *where* do I place any files I generate on a per-user or
per-application basis? For example, I cannot place user settings in the
\Program Files\My Application directory, because many users won't have write
access to it. Should I place it into the documents and settings\application
data\bla bla directory? Where should I place application settings (such as
the database connection string).

I'm sure there must be some .NET wide scheme for managing all this.

Thanks for your advice,



Robin
 
R

Robin Tucker

I was under the impression that the application configuation file resides in
the same place as the application itself and therefore will not be writable
by ordinary users. I want to store things like "options" on a per-user
basis.
 
H

Herfried K. Wagner [MVP]

Robin Tucker said:
I'm a bit confused about where to put my program settings.

Firstly, I can choose (I suppose) between .ini, .xml or the registry.
Which one is best?

Personal preference.

If human-readability is important, use classic INI files.
If the file should be read easily by the machine, use XML files.

Storing and loading user preferences
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=userpreferences&lang=en>

Creating Your Own Dynamic Properties and Preserve Property Settings in
Visual Basic .NET
Secondly, *where* do I place any files I generate on a
per-user or per-application basis?

\\\
Dim s As String = _
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)
///
Where should I place application settings (such as the database connection
string).

Application configuriation files ("App.config").

..NET Framework Developer's Guide -- Configuration Files
<URL:http://msdn.microsoft.com/library/en-us/cpguide/html/cpconconfigurationfiles.asp>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top