S
sck10
Hello,
Currently, I have two web.config files on different machines (test and
production). The only difference between the two is that the
connectionstring and appsettings point to different data sources (testdb and
productiondb). Is there a way to use something like an if statement or case
statement in a web.config file to determine which connection string or app
settings to use depending on the machine name?
--
Thanks in advance,
sck10
Data Source # 1
------------------------
<configuration>
<connectionStrings>
<add
name="cnnSQL"
connectionString="Data Source=DataSource01;
Persist Security Info=True;
Initial Catalog=MyDB;
User ID=MyUser;
Password=MyPswd"
providerName="System.Data.SqlClient" />
</connectionStrings>
<appSettings>
<add
key="cnnSQL"
value="Server=DataSource01;
User ID=MyUser;
Password=MyPswd;
Database=MyDB;
Persist Security Info=True;
Network Library=dbmssocn"/>
</appSettings>
Data Source # 2
------------------------
<configuration>
<connectionStrings>
<add
name="cnnSQL"
connectionString="Data Source=DataSource02;
Persist Security Info=True;
Initial Catalog=MyDB;
User ID=MyUser;
Password=MyPswd"
providerName="System.Data.SqlClient" />
</connectionStrings>
<appSettings>
<add
key="cnnSQL"
value="Server=DataSource02;
User ID=MyUser;
Password=MyPswd;
Database=MyDB;
Persist Security Info=True;
Network Library=dbnmpntw"/>
</appSettings>
Currently, I have two web.config files on different machines (test and
production). The only difference between the two is that the
connectionstring and appsettings point to different data sources (testdb and
productiondb). Is there a way to use something like an if statement or case
statement in a web.config file to determine which connection string or app
settings to use depending on the machine name?
--
Thanks in advance,
sck10
Data Source # 1
------------------------
<configuration>
<connectionStrings>
<add
name="cnnSQL"
connectionString="Data Source=DataSource01;
Persist Security Info=True;
Initial Catalog=MyDB;
User ID=MyUser;
Password=MyPswd"
providerName="System.Data.SqlClient" />
</connectionStrings>
<appSettings>
<add
key="cnnSQL"
value="Server=DataSource01;
User ID=MyUser;
Password=MyPswd;
Database=MyDB;
Persist Security Info=True;
Network Library=dbmssocn"/>
</appSettings>
Data Source # 2
------------------------
<configuration>
<connectionStrings>
<add
name="cnnSQL"
connectionString="Data Source=DataSource02;
Persist Security Info=True;
Initial Catalog=MyDB;
User ID=MyUser;
Password=MyPswd"
providerName="System.Data.SqlClient" />
</connectionStrings>
<appSettings>
<add
key="cnnSQL"
value="Server=DataSource02;
User ID=MyUser;
Password=MyPswd;
Database=MyDB;
Persist Security Info=True;
Network Library=dbnmpntw"/>
</appSettings>