Solved

Configuration File

Posted on 2004-08-17
3
220 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
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…

680 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