I want to edit a web application's config at runtime, specifically the file that is referenced by a configSource attribute. Whenever I try to open the file using the WebConfigurationManager, I always get the web.config, not rewrite.config.
Once I get it open, I want to edit it (e.g. clear out existing entries, add new entries) and save it back out to rewrite.config.
Am I better off just reading it in as a file (e.g. System.IO)
web.config
<system.webServer>
<rewrite>
<rules configSource="rewrite.config" />
</rewrite>
rewrite.config
<rules>
<rule name="rewrite1" stopProcessing="true">
<match url="^contact-us.html$" />
<action type="Rewrite" url="/contact-us" />
</rule>
<rule name="rewrite2" stopProcessing="true">
<match url="^about-us.html$" />
<action type="Rewrite" url="/about-us" />
</rule>
</rules>