How do I effectively store a connection string in machine.config only?

Posted by Scott Bedwell on Stack Overflow See other posts from Stack Overflow or by Scott Bedwell
Published on 2010-06-16T20:40:32Z Indexed on 2010/06/16 20:42 UTC
Read the original article Hit count: 208

We are moving to an environment with multiple engines of MS SQL running on the same server (a test engine and a production engine). We also have separate test and production web servers, and would like for our asp.net applications to "magically" use the test database engine on the test web server and the production database engine on the production web servers. We would like to store the connection strings in machine.config rather than in web.config, but when we put it in machine.config, visual studio's IDE (particularly with datasets) does not recognize that the machine.config contains the connection.

Does anyone know of a solution for displaying these machine.config connection strings in visual studio, or of a different solution that would accommodate for this?

Thanks.

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about sql