Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to update an XML file...

Status
Not open for further replies.

CharlieIT

MIS
Apr 9, 2003
157
US
I am working on a utility which helps the user to setup the web.config file (which is of course, an XML document)for their environment.

After answering several questions in the app, the user hits "finish" which should then update the following string in the web.config with the user's specific environment's settings...

<appSettings>

<add key=&quot;ConnectionString&quot; value=&quot;provider=SQLOLEDB;Data Source=servername;Database=databasename;UID=username;Password=password&quot; />

I have everything working at this point, EXCEPT I do not know how to update the XML document with the information I have collected.

Can anyone help? How do I update the XML document (assume the location of the XML document is &quot;c:\web.config&quot;)





 
Hi CharlieIT,

I just have had success with the XMLSerializer object for a Windows application. I used the technique here:

to serialize database connection strings, user settings, etc to an XML file.

I think that this would apply to ASP.NET applications as well.

Hope this gets you started.

Regards,

BP
 
Thanks Beeps, but I'm afraid I'm a bit of a newbie.

Would you (or anyone else) be able to show me, in this thread, how to write a simple app which will update a web.config file with a vb.net windows application? For instance: Can you just have a form with a button called &quot;update&quot; which updates...

<settings>
<people>bob</people>

to...

<settings>
<people>sally</people>

...it would really help me out.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top