We are planning on making a c# script to automate the copying of rewrite rules from one web.config to another. We have multiple web.config's for each customer, and we have some general rewrite rules that sometimes need to be changed. The general rewrite rules have a unique prefix that identifies them as a general rule (and not customer-specific).
We're wondering if it's possible to copy rules from one web.config to another with C#. Just reading the rewrite url/match url from one config to write it to the other may not always do the job; it amy happen that we sometimes need to add conditions as well, for example.
Are there any ways to do this? We would like to automate it as much as possible. I am not the best at c#, but I would imagine it might be possible to read the entire rule off one file and paste it in the other? Or might it be better to just parse both the web.config files via XMLReader and then copy the rules over?