PC Review


Reply
Thread Tools Rate Thread

Best places to put user/application settings? Confused!

 
 
Robin Tucker
Guest
Posts: n/a
 
      27th Oct 2004

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


 
Reply With Quote
 
 
 
 
Richard L Rosenheim
Guest
Posts: n/a
 
      27th Oct 2004
The recommended place is the application's configuration file.

Here's couple links to point you in the right direction:

http://msdn.microsoft.com/library/de...figuration.asp

http://msdn.microsoft.com/library/de...FileSchema.asp


"Robin Tucker" <(E-Mail Removed)> wrote in
message news:clo7d3$83p$1$(E-Mail Removed)...
>
> 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
>
>



 
Reply With Quote
 
Robin Tucker
Guest
Posts: n/a
 
      27th Oct 2004
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.

"Richard L Rosenheim" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> The recommended place is the application's configuration file.
>
> Here's couple links to point you in the right direction:
>
> http://msdn.microsoft.com/library/de...figuration.asp
>
> http://msdn.microsoft.com/library/de...FileSchema.asp
>
>
> "Robin Tucker" <(E-Mail Removed)> wrote in
> message news:clo7d3$83p$1$(E-Mail Removed)...
>>
>> 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
>>
>>

>
>



 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      27th Oct 2004
"Robin Tucker" <(E-Mail Removed)> schrieb;
> 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
<URL:http://msdn.microsoft.com/library/en-us/dv_vstechart/html/vbtchcreateyourowndynamicpropertiespreservepropertysettingsinvisualbasicnet.asp>

> 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>

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Application Settings user settings storage directory Chris Crowther MBCS Microsoft Dot NET 5 9th Apr 2008 10:02 AM
My.Settings Application and User Scope Settings =?Utf-8?B?TUFUVA==?= Microsoft Dot NET Framework Forms 1 28th Mar 2007 11:14 PM
Confused about My Network Places =?Utf-8?B?VmluY2U=?= Windows XP Networking 0 8th Nov 2006 01:24 AM
Problem with user control and application/user settings GAZ Microsoft Dot NET Framework Forms 1 24th Jul 2006 12:14 PM
ConfigurationManager, user settings and application settings Mark Ingram Microsoft Dot NET Framework 3 17th Jan 2006 05:40 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:39 AM.