The .config files are really meant for design-time write and run-time read. If you write to them at runtime, you run the risk of running into caching problems when you try to read back.
Fortunately, Microsoft has come out with a good read-write at runtime solution that doesn't require messing with your config file at all. Take a look at the Configuration Management Application Block at: http://www.microsoft.com/downloads/details.aspx?FamilyID=85cb1c53-8ca7-4 a92-85e3-e4795bd27feb&displaylang=en HTH --Jekke -----Original Message----- From: Unmoderated discussion of advanced .NET topics. [mailto:[EMAIL PROTECTED] On Behalf Of Clark, Michael (OFM) Sent: Friday, October 15, 2004 6:44 PM To: [EMAIL PROTECTED] Subject: [ADVANCED-DOTNET] How to Programmatically Maintain .config files? I've been looking to see how I would go about maintaining a .config file using some functionality of the System.Configuration class, but all it seems to be able to do is read the web.config or app.config files and report the contents. But what if you want to retain user-configurable settings in a .config file (without asking the user to mess with the configuration file directly)? I know it has to be do-able, but I can't seem to find any documents about it. Or do I have to read the .config file as an xml file into an XmlDocument and manipulate it that way? It would be nice if there was a simpler way. =================================== This list is hosted by DevelopMentor(r) http://www.develop.com Some .NET courses you may be interested in: Essential .NET: building applications and components with CSharp August 30 - September 3, in Los Angeles http://www.develop.com/courses/edotnet View archives and manage your subscription(s) at http://discuss.develop.com =================================== This list is hosted by DevelopMentor� http://www.develop.com Some .NET courses you may be interested in: Essential .NET: building applications and components with CSharp August 30 - September 3, in Los Angeles http://www.develop.com/courses/edotnet View archives and manage your subscription(s) at http://discuss.develop.com
