c# - Editing configSource file at runtime -
i want edit web application's config @ runtime, file referenced configsource attribute. whenever try open file using webconfigurationmanager, web.config, not rewrite.config.
once open, want edit (e.g. clear out existing entries, add new entries) , save out rewrite.config.
am better off reading in 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>  
 
  
Comments
Post a Comment