I have the source code of an application that I support. In my web.config file, I have connection strings for both test and production databases:
<add name="conn" connectionString="Data Source=TestDBServer; (etc...)">
<add name="conn" connectionString="Data Source=ProdDBServer; (etc...)">
Whenever I am in a test, I just comment out the production connection string and vice versa. For example, when I finish testing, I will comment out the test connection string and uncomment the production connection string, and then deploy.
I am very early in my development career, but it seems to me that there should be a better or more standard way to handle this. What should I do?
Edit
Guillerme Lofrano Corneto related an identical question that fully answers my own question. Since then I have been marked as a duplicate. Here's the link:
Change the connection string from development to release when publishing
source
share