I can't answer for ASP.NET 2.0. But for ASP.NET 1.1, you can define
custom sections in the config file, then, pass in the custom section
name to your method, and pluck the value from the appropriate section.
So, your web.config might look like this (definition of the custom
sections, followed by custom sections):
<configuration>
<configSections>
<section
name="dev" type="System.Configuration.NameValueFileSectionHandler,
System, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089"/>
<section
name="stage" type="System.Configuration.NameValueFileSectionHandler,
System, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089"/>
<section
name="prod" type="System.Configuration.NameValueFileSectionHandler,
System, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089"/>
</configSections>
<dev>
<add key="AppRootDir" value="/Authoring/"/>
</dev>
<stage>
<add key="AppRootDir" value="/S-Authoring/"/>
</stage>
<prod>
<add key="AppRootDir" value="/P-Authoring/"/>
</prod>
</configuration>
Then, write a class that retrives the values by section, using a call
such as:
NameValueCollection nvc =
(NameValueCollection)ConfigurationSettings.GetConfig("dev");
-- then return the value you want:
string AppRootDir = nvc["AppRootDir"]; //returns "/Authoring/"
-Hope this helps