You developed webapplication, you hosted in two different server.One server name is
"Production" and another server name is "Testing". The below code connection string will change dynamically based on server host information.
Example:
<appsettings>
<add key="production" value="http://www.production.com">
<add key="ProductionconnectionString" value="server=localhost;...." >
<add key="testconnectionString" value="server=localhost;...." >
</appsettings>
Public Application_BeginRequest()
{
bool production=false;
if(Request.URL.Host==ConfiqurationManager.Appsettings("production"))
{
Production=true;
}
}
if(Production==true)
{
context.items.add("connectionStrings",ConfiqurationManager.Appsettings("production"))
}
else
{
context.items.add("connectionStrings",ConfiqurationManager.Appsettings("test"))
}
}