Creating and Consuming XML configuration

  • Thread starter Thread starter Christopher Ambler
  • Start date Start date
C

Christopher Ambler

Is there an example anywhere of how to create and consume XML configuration
information via code?

I've got a site for which I want to present the user with a web form for
configuration information and allow them to fill in the form and persist it
to an XML file on the web server. This XML file can then be read at run-time
for another page to use in constructing itself. The form code and
customization code I have done - but I'm wondering if there's a "best
practices" example on how to create and consume and XML config file.

I've come to the conclusion that using the DOM to write to the web.config is
a bad idea, since, as has been pointed out to me, it will cause a re-start
every time it's written.

Thanks in advance!

Christopher
 
If you didn't need to write the data back out, this is how you use the
web.config file to store crap:

http://www.c-sharpcorner.com/Code/2002/June/ConfigApp.asp

I'm a big fan of keeping things like you describe in a database. In today's
day and age, with fast networks, fast processors - a local database (SQL2K,
NOT Access) can really be considered part of the immediate app.. because
access time is so negligible...
 
Thanks for replying, but let me state it again.

I do want to write it back out, as I said below:
I've got a site for which I want to present the user with a web form for
configuration information and allow them to fill in the form and persist
it to an XML file on the web server.

And while I realize that a database is always a good option, I not only
don't have rights to install one on this server, but don't have the spare
cash to purchase SQL server for such a small site.

I'm looking for an example of what I *want* to do, not what I *should* be
doing :-)

Christopher
 
Back
Top