|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
AppSettings file="user.config" for connectionstring in .NET2.0Hi!
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: <appSettings file="..\user.config"> <add key="ConnStr" value=" .. "/> </appsettings> 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? TIA! mortb Hi Mortb,
Unfortunately, the connectionString element does not have an attribute to override it to another file. You can check the following link for more information on How to: Read Connection Strings from the Web.config File. http://msdn2.microsoft.com/en-us/library/ms178411.aspx Or you have to keep the connection string the appSetting section. Also, you can put the connection string in the connectionString element and try not to check in the whole web.config file. Kevin Yu Microsoft Online Community Support ============================================================================ ========================== When responding to posts, please "Reply to Group" via your newsreader so that others may learn and benefit from your issue. ============================================================================ ========================== (This posting is provided "AS IS", with no warranties, and confers no rights.)
Show quote
"mortb" <mortb@nospam.nospam> wrote in message Use configSource attribute, something like: <connectionStrings news:ubPr8UEZGHA.4580@TK2MSFTNGP03.phx.gbl... > Hi! > > 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: > > <appSettings file="..\user.config"> > <add key="ConnStr" value=" .. "/> > </appsettings> > > 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? configSource="..." ... -- Miha Markic [MVP C#] RightHand .NET consulting & development www.rthand.com Blog: http://cs.rthand.com/blogs/blog_with_righthand/ |
|||||||||||||||||||||||