manipulation of configuration files programmatically

  • Thread starter Thread starter venkatmudireddy
  • Start date Start date
V

venkatmudireddy

hi,

how to insert or update configuration(.config) files using xml api or
with some thing else
i mean inserting a new element into particular section
e.g: i want to programmatically add an entry to appsettings section

i tried it with .xml extension but not working out with .config
extension

plz help me
 
Hi venkatmudireddy,

If you're using the .NET Framework 2.0, things are significantly easier. Do
a google for 'ConfigurationManager' on MSDN. That will give you the tope page
for all the configuration-related classes.

If you're using the .NET Framework v1.x, you're going to have to do a bit
more work and treat the .config file as a regular XML document using the
classes in System.Xml. From there, you'd want to load the file into an
XmlDocument, then add your extra config items, then save the file back to the
right location.

HTH,

Adam
 
Back
Top