471,339 Members | 1,193 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

where to save app settings?

It is my understanding that in .Net the registry is not the
prefered place to save application settings. What has Microsoft
put in place to replace it? I thought it was the .config file,
but I am unable to figure out how to write to the file.

Sam
Jul 21 '05 #1
5 6580
Hi Sam,

Using .config files is the popular way of storing configuration infomation.

Note that the .config file of an app is read only the first time it is
loaded - any further changes you make to the .config file will not be
reflected in the app, and therefore, will be read only on read in the next
run of the app.

Also check out:
http://www.grimes.demon.co.uk/dotnet/configFAQ.htm

HTH,
Rakesh Rajan

"Sam Carleton" wrote:
It is my understanding that in .Net the registry is not the
prefered place to save application settings. What has Microsoft
put in place to replace it? I thought it was the .config file,
but I am unable to figure out how to write to the file.

Sam

Jul 21 '05 #2
Hi,

Link to MSDN article on appSettings section
http://msdn.microsoft.com/library/de...ngssection.asp

HTH,
Rakesh Rajan

"Rakesh Rajan" wrote:
Hi Sam,

Using .config files is the popular way of storing configuration infomation.

Note that the .config file of an app is read only the first time it is
loaded - any further changes you make to the .config file will not be
reflected in the app, and therefore, will be read only on read in the next
run of the app.

Also check out:
http://www.grimes.demon.co.uk/dotnet/configFAQ.htm

HTH,
Rakesh Rajan

"Sam Carleton" wrote:
It is my understanding that in .Net the registry is not the
prefered place to save application settings. What has Microsoft
put in place to replace it? I thought it was the .config file,
but I am unable to figure out how to write to the file.

Sam

Jul 21 '05 #3
The .config file is the prefered place to store application settings.
However, they should not be changed by the application.

User configured settings should be saved to the user's folder (use
Environment.SpecialFolder.ApplicationData or
Environment.SpecialFolder.LocalApplicationData) - NOT the application
folder, where the .config file is.
A simple way to store user settings is create a class to hold all of
your settings and the serialize it to an XML file in the special folder.
You then de-serialize the file to restore the settings.
Sam Carleton wrote:
It is my understanding that in .Net the registry is not the
prefered place to save application settings. What has Microsoft
put in place to replace it? I thought it was the .config file,
but I am unable to figure out how to write to the file.

Sam

Jul 21 '05 #4
"Sam Carleton" <sc**************@miltonstreet.com> wrote in message
news:LS****************@tornado.ohiordc.rr.com...
It is my understanding that in .Net the registry is not the
prefered place to save application settings. What has Microsoft
put in place to replace it? I thought it was the .config file,
but I am unable to figure out how to write to the file.


The .config file is for application settings, not user settings. For user
settings, you probably want to save the data in "Isolated Storage". You can
go to www.genghisgroup.com where you will find a free set of tools that
includes a Preferences class that saves user preferences in Isolated
Storage.
Jul 21 '05 #5
See the Enterprise Library, a seperate download from MS
http://msdn.microsoft.com/library/de...tml/entlib.asp

The configuration application block will allow you to read and write
configuration settings. Even though the design of this AB is highly
flexible and extensible, you do not need to create new storage provider to
use the XML config files.

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"Sam Carleton" <sc**************@miltonstreet.com> wrote in message
news:LS****************@tornado.ohiordc.rr.com...
It is my understanding that in .Net the registry is not the
prefered place to save application settings. What has Microsoft
put in place to replace it? I thought it was the .config file,
but I am unable to figure out how to write to the file.

Sam

Jul 21 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Sam Carleton | last post: by
10 posts views Thread by Paul Cheetham | last post: by
2 posts views Thread by John | last post: by
4 posts views Thread by Ronald S. Cook | last post: by
3 posts views Thread by Scott M. | last post: by
reply views Thread by rosydwin | last post: by

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.