I want to recommend to use rewrite maps for that purpose. And store rewrite map in another file. In your web.config it will be:
<rewrite>
<rewriteMaps configSource="rewriteMaps.config"/>
<rules configSource="rewriteRules.config"/>
</rewrite>
In your rewriteRules.config;
<rules>
<rule name="Rule for Redirects">
<match url=".*" />
<conditions>
<add input="{Redirects:{REQUEST_URI}}" pattern="(.+)" />
</conditions>
<action type="Redirect" url="{C:1}" appendQueryString="false" />
</rule>
</rules>
In your rewriteMaps.config:
<rewriteMaps>
<rewriteMap name="Redirects">
<add key="/old1" value="/new1" />
<add key="/old2" value="/new2" />
</rewriteMap>
</rewriteMaps>
And URL Rewrite Module should be installed in your IIS
You can fill rewriteMaps programmatically, if you have DB with old urls. Sample of simple logic is here:
var urls = new Dictionary<string, string>();
urls.Add("/old", "/new");
var lines = new List<string>();
lines.Add("<rewriteMaps>");
lines.Add("<rewriteMap name=\"Redirects\">");
foreach (var url in urls)
{
lines.Add(string.Format("<add key=\"{0}\" value=\"{1}\" />", url.Key, url.Value));
}
lines.Add("</rewriteMap>");
lines.Add("</rewriteMaps>");
System.IO.File.WriteAllLines(@"rewriteMaps.config", lines);