473,385 Members | 1,338 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Best places to put user/application settings? Confused!


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
Nov 21 '05 #1
3 1885
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" <id*************************@reallyidont.com> wrote in
message news:cl*******************@news.demon.co.uk...

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

Nov 21 '05 #2
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" <ri*****@rlr.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
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" <id*************************@reallyidont.com> wrote in
message news:cl*******************@news.demon.co.uk...

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


Nov 21 '05 #3
"Robin Tucker" <id*************************@reallyidont.com> 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/vbtchcreateyourowndynamicpropertiespreservepropert ysettingsinvisualbasicnet.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.SpecialFolde r.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/>

Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Steve | last post by:
Can anyone tell me the preferred method for writing and retrieving persistent information using .Net. Specifically, I am referring to information that you used to see in registry keys or .ini...
7
by: MrNobody | last post by:
I was a Java developer so I'm used to using property files as a means to keep configuration settings for my apps. I'm wondering what options are there with ..NET? Some settings I want to include...
0
by: Anonieko Ramos | last post by:
ASP.NET Forms Authentication Best Practices Dr. Dobb's Journal February 2004 Protecting user information is critical By Douglas Reilly Douglas is the author of Designing Microsoft ASP.NET...
4
by: Marco | last post by:
Hi to All, I'm developing an application in VB .NET. I have a question: what is the best place to save personal settings of my users? I mean, when a user uses my application, it can create a...
11
by: Tom | last post by:
I am planning on adding a Preferences form to my application and using the Property Grid to display the preferences to the user. What do you think would be the best way to save these preferences...
3
by: tshad | last post by:
I need to pass a few parameters to my Windows Service program. The end user will be changing the parameters and settings should be saved. What is the best practice - use app.config - use .ini...
1
by: Confused XML hacker | last post by:
My application needs to be able to parse and validate either a DTD or schema based document without knowing in advance which form of grammar a document is using. (New documents presented to my...
14
by: Keith | last post by:
I have an MDE application used by several hundred people in different parts of the world. The majority of users are of lesser experience computer experience. The app consists of a frontend (MDE)...
1
by: John Salerno | last post by:
I'm thinking about writing a small script that will update an xml file with whatever game settings the user enters. I imagine that the user will have a single-screen GUI application with several...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.