F
Frankie
I'm writing a small utility app (C# Windows forms) used to create new
ASP.NET Web sites. This utility needs to be able to change existing values
in an existing Web.config. Please note: I do NOT want to make this change
from any currently running Web application. Rather, I plan to have a
"base/standard Web.config" that is copied then updated by the utility app
for each new Web site.
I'm hoping there is some straight-forward way to do this. I have Googled
this and found lots of overly-complicated stuff (like rewriting the entire
file, doing stuff with XSLT,etc). I'm relatively new to working with XML
files, and that other stuff just seems overkill.
The following is an abbreviated version of the Web.config file:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="MyKey" value="MyValue" />
</appSettings>
<!-- other stuff here -->
</configuration>
What I want to be able to do is to programmatically change the entry in
<appSettings>...
FROM
<add key="MyKey" value="MyValue" />
TO
<add key="MyKey" value="YourValue" />
Thanks!
ASP.NET Web sites. This utility needs to be able to change existing values
in an existing Web.config. Please note: I do NOT want to make this change
from any currently running Web application. Rather, I plan to have a
"base/standard Web.config" that is copied then updated by the utility app
for each new Web site.
I'm hoping there is some straight-forward way to do this. I have Googled
this and found lots of overly-complicated stuff (like rewriting the entire
file, doing stuff with XSLT,etc). I'm relatively new to working with XML
files, and that other stuff just seems overkill.
The following is an abbreviated version of the Web.config file:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="MyKey" value="MyValue" />
</appSettings>
<!-- other stuff here -->
</configuration>
What I want to be able to do is to programmatically change the entry in
<appSettings>...
FROM
<add key="MyKey" value="MyValue" />
TO
<add key="MyKey" value="YourValue" />
Thanks!