Multiple customized versions of web.config

G

Guest

Hi.

I've got a standard setup with a web app (ASP.NET 2.0) that I develop on my
machine, deploy to a QA server for testing, and then on to a PROD
environment. To facilitate the deployment process, I am utilizing our SCM
tool and things are working just fine. I make a change on my machine, commit
it, and update the QA machine and the change is immediately visible in the
web app there.

The irritating thing is that I often make changes to web.config. There are
over a dozen configuration differences between my development version and
those running on the QA and PROD servers (e.g. databases, membership
providers, etc.). I'm looking for a way to extract those changes out of the
file so that there can be a separate version in all 3 environments. Any ideas?

Thanks
 
B

Brock Allen

Consider putting those settings in a higher level web.config file, such as
at the site level or the root web.config/machine.config files. Settings in
higher level .config files are inherited by your ASP.NET application.

-Brock
DevelopMentor
http://staff.develop.com/ballen
 
G

Guest

Excellent. Thanks Karl.

The <AppSettings> "file" attribute appeals to me. I can see it will work for
a lot of my programming, like connection strings. But, how can I use it for
the declarative stuff, like membership and role management? For example,
SqlMembershipProvider needs a connectionStringName in web.config that points
to an entry in <connectionStrings>. If I put my connection strings into
<AppSettings> (which I want to), how can <membership> get hold of it?
 
K

Karl Seguin

Why can't you simply use a File="blah.config" in the connectionStrings
section?

Karl
 
G

Guest

Because, and I quote from MSDN "This functionality is limited to the
appSettings attribute.". However, "In the .NET Framework version 2.0, you can
now include configuration settings in a separate file for all configuration
elements that support the configSource attribute". This I have done in the
connectionStrings section with success.

Thanks again.
 

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

Top