In my asp.net website i have multiple connectionstring in web.config. I need to pick a connection string when i publish on my local server for test, and the other one when I have to publish on "real server" when i need to release.
<!-- LOCAL SQLEXPRESS -->
<add name="LocalConnectionString" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=TimeLive;Persist Security Info=True;User ID=*********;Password="*********" providerName="System.Data.SqlClient"/>
<!-- IPR-GEST SQLEXPRESS -->
<add name="ServerReleaseConnectionString" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=TimeLive;Persist Security Info=True;User ID=*********;Password=*********" providerName="System.Data.SqlClient"/>
Since the two connectionString differs from user login, I thought it's possible changing server authentication switching to "Windows Authentication", but sounds like less secure. Am I wrong?
How can I choose the right connectionString depending on I publish on local or release server?
Also, the solution contains a dll project with a .dbml file. Same problem: two different connectionString, one for each server. Is there a simple way to choose the right one?
Depending which version of Visual Studio you have, it has Web.config File Transformations, it allows you to have a configuration template for development and another for production.
http://www.asp.net/mvc/tutorials/deployment/visual-studio-web-deployment/web-config-transformations