Solved

Configuration File

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Query datatable in LINQ 6 39
Custom auto number 6 51
VB.net PaintEventArgs Handling. 10 28
VB.NET HttpWebRequest 12 34
Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

760 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now