AppSettings file="user.config" for connectionstring in .NET2.0 - 04-19-2006 , 01:51 AM
To ensure that my development connectionstring wasn't the one used for our
live website I have used a development configuration file that overrides the
appsettings section. Syntax as follows:
<add key="ConnStr" value=" .. "/>
I thought this worked really good allowing me to keep my development
connection string from beeing checked into sourcesafe.
However, in .Net 2.0 there is a new section <connectionStrings /> . Is it
possible to override this section as well or does someone have an equal, or
even better, solution?
Re: AppSettings file="user.config" for connectionstring in .NET2.0 - 04-22-2006 , 06:39 PM
Yes, check out external configuration files. You can store a
configuration file fragment consisting of a single section in a
separate file and reference it from your web.config file. Your
web.config configuration section would look like this:
<?xml version='1.0' encoding='utf-8'?>
And your external connections.config file would look like this (do not
type in any other tags or directives):
connectionString="Valid Connection String;" />
You then use the ConfigurationManager or WebConfigurationManager to
retrieve it by name or provider name.
On Wed, 19 Apr 2006 08:51:48 +0200, "mortb" <mortb (AT) nospam (DOT) nospam>
|Thread Tools||Search this Thread|