Solved

Configuration File

Posted on 2004-08-17
3
218 Views
Last Modified: 2010-04-23
VB.NET + SQL SERVER 2000

I am about to start work on an application that maybe deployed in a terminal services environment. Currently I use the registry to store the settings for each system user. I have read a few books on .NET that seem to steer away from the registry. The one problem I can see with a configuration file is that all the users settings are grouped together in a single file, this may be a good thing. I guess what I am asking is, is it down to personal preference or is there a documented right way and wrong way. Also I normally store the SQL Server name and login details in the same area, is this standard practice?

0
Comment
Question by:rocky050371
  • 2
3 Comments
 
LVL 1

Accepted Solution

by:
jzwaenepoel earned 125 total points
ID: 11819461
Actually,

The configuration file is good place to store read-only settings, so it is not the correct place to store user-configurable settings.

The config-file can be used for setiings that are not to be modified by the end-user, but maybe by an administrator.  For example a database connection string (watch out with passwords) or trace-level-settings, etcetera.

User configurable settings should be stored in a file in the Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) folder or a subfolder.
I usually use an INI-file or an XML-file for these settings

Hope this helps,

Joris

0
 

Author Comment

by:rocky050371
ID: 11819544
Thank you, that does help. I take it you install the config file to the app path. Also I seem to remember that there is a built in configuration file utility, but can't think where. Any ideas?
0
 
LVL 1

Expert Comment

by:jzwaenepoel
ID: 11819656
Thanks,

The config file goes in the app path (and has the same name as the exe-file with ".config" appended).

I do not know about a built-in configuration file utility.

All I know is that if you add an app.config file to your project, then it is copied to the the bin-folder with every build and gets its correct name automatically.  You have to edit the XML file manually.  In the IDE, you can open the config-file and then click select "XML" or "Data" (left-lower corner of the screen).  Maybe the "data"-view is what you remember as the built-in configuration utility?  

Joris
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question