Different settings in web.config, based on host

D

Daves

since I have some settings different on my local host (where I develop) and
my ISP's (where I upload my final developments) I need different settings in
my web.config. For example the dbase connection strings are different and
then I want to have debug=true locally but not on ISP host.

How would you solve this, can I programmatically set which web.config file
to use eg. in global.aspx depending on server name?
 
P

Phillip Ian

I simply don't copy the web.config file when I deploy. Of course, if I
make changes that need to be in both, I have to make them twice. But
really, how often do you change the web.config anyway?

Of course, if you're using a deploy project, I'm not sure if that's
possible.
 
D

Daves

probably you're right; do-not-copy, just thought maybe there was some pro
way of doing this. BTW, what exactly is a "deploy-project" ?
 
P

Phillip Ian

I'm not ruling out some fancy way of doing it mind you...I've never
claimed to be a pro. :)

I was referring to the Setup Project type in VS. Packages up your
program or site for deployment. I've never used them for web
apps...only Windows.
 
K

KMA

There is a way to add an "include" to the web.config.

The included file contains all the information that is site specific
information. That way you can still copy the web.config. The downside is
that if you change the site specific stuff you have to propagate a reload of
your app otherwise it won't be picked up, whereas simply saving web.config
would make changes immediately.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top