General tips
I recommend saving the path in your settings. There are reasons why some of our projects need different paths and URLs, and we cannot always avoid using the tilde (~).
Our strategy
In our projects here, in Inntec, our web.config contains a database connection string and a variable indicating what the environment is - Production, Staging, Development, etc.
Then in the database we have a set of variables for each environment, and there is a class that takes a lot of settings and pulls / caches the correct setting for the current environment. Therefore, in our code we can say: Settings.AppUrl and everything just works.
We use Redgate Sql Data Compare to synchronize settings in all instances (therefore, in each environment there are always settings for all environments), and there are unit tests that ensure that each environment has a full batch of settings.
This is one way to do this ... Until now, it has worked very well for us.
source share