Home All Groups Group Topic Archive Search About

Writing to the APP.CONFIG file

Author
12 Jan 2006 9:53 PM
John Cosmas
How would I write or update a key in a section of the APP.CONFIG or my
application's.EXE.CONFIG file?

Author
16 Jan 2006 2:08 AM
Christopher Reed
Treat like an XML document.  Remember that you'll need to have modify rights
on the file.
--
Christopher A. Reed
"The oxen are slow, but the earth is patient."

Show quote
"John Cosmas" <johncos***@charter.net> wrote in message
news:W5yyf.52$fK1.19@fe05.lga...
> How would I write or update a key in a section of the APP.CONFIG or my
> application's.EXE.CONFIG file?
>
Author
16 Jan 2006 3:01 AM
Kevin Spencer
This is only possible in .Net Framework 2.0.

You can use the ConfigurationElement.SerializeElement() method. The
IsReadOnly Property will inform you if the ConfigurationElement can be
modified.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
You can lead a fish to a bicycle,
but it takes a very long time,
and the bicycle has to *want* to change.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
You can lead a fish to a bicycle,
but it takes a very long time,
and the bicycle has to *want* to change.

Show quote
"John Cosmas" <johncos***@charter.net> wrote in message
news:W5yyf.52$fK1.19@fe05.lga...
> How would I write or update a key in a section of the APP.CONFIG or my
> application's.EXE.CONFIG file?
>
Author
23 Jan 2006 4:44 PM
Mary Chipman [MSFT]
As Christopher pointed out, you will need permissions on the
config.file. The new System.Configuration namespace contains new
classes for working with configuration files (using the
ConfigurationManager). It is best documented in the "Protected
Configuration" topics for ASP.NET apps, but can also be applied to
Windows apps. See also "Storing and Retrieving Connection Strings"
http://msdn2.microsoft.com/en-us/library/ms254494.aspx for some sample
code demonstrating reading and writing to the connectionStrings
section.

--Mary

On Thu, 12 Jan 2006 15:53:27 -0600, "John Cosmas"
<johncos***@charter.net> wrote:

Show quote
>How would I write or update a key in a section of the APP.CONFIG or my
>application's.EXE.CONFIG file?
>

AddThis Social Bookmark Button