My hosting provider assigns the server name, database name, user name and password after I import/upload my SQL server database to them. When I run locally for testing it will be different. How can I effectively test and publish my site without having to change this all the time?

Recommended Answers

All 2 Replies

In your web.config file, keep two different connection strings stored, then just change which one is being used based off of your environment. At work, we have 3 tiers to publishing our sites, development, pre-production, and production. Each one has it's own database server, so we simply keep 3 connections stored in our web.config, one named dev, one called PreP, and the last is simply Prod.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.