whats a good way to be able to keep 2 connection strings to SQL server in the web .comfig and have the app pick the correct one when its in the prod and dev servers?
i think i saw once some cool ways to keep variables like app settings holding two sets of values just like i am trying to do with my connection string to SQL… but i diont remmeber where i saw it..
can anyone help me figure this out?
my dev and prod servers vary by the port they use. so i have mysite.com and mysite.com:81
Which version of ASP.NET are you using? In the latest release (ASP.NET 4.0) you can perform simple transformations on your Web.config file based on the build configuration of your project. For example, when you build in “Release” mode, then you can tell the Web.config.release file to transform your connection strings and replace them with the appropriate production versions.
There’s a great article on MSDN about how to do this here: http://msdn.microsoft.com/en-us/library/dd465326.aspx