Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
DotNet
acad.assignment.mngr
academic
adonet
aspnet
aspnet.announcements
aspnet.build.controls
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
clr
compactframework
component_services
datatools
distributed_apps
drawing
faqs
framework
framework.wmi
general
internationalization
interop
languages.csharp
languages.jscript
languages.vb
languages.vb.controls
languages.vb.data
languages.vb.upgrade
languages.vc
languages.vc.libraries
myservices
odbcnet
performance
remoting
scripting
sdk
security
setup
vjsharp
vsa
webservi.enhancements
webservices
windowsforms
windowsforms.controls
winforms.databinding
winforms.designtime
xml
  
 
date: Wed, 19 Apr 2006 08:51:48 +0200,    group: microsoft.public.dotnet.datatools        back       


AppSettings file="user.config" for connectionstring in .NET2.0   
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?
date: Wed, 19 Apr 2006 08:51:48 +0200   author:   mortb am

Re: AppSettings file="user.config" for connectionstring in .NET2.0   
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'?>
<configuration>
    <connectionStrings configSource="connections.config"/>
</configuration>

And your external connections.config file would look like this (do not
type in any other tags or directives):

  <connectionStrings>
    <add name="Name" 
     providerName="System.Data.ProviderName" 
     connectionString="Valid Connection String;" />
  </connectionStrings>

You then use the ConfigurationManager or WebConfigurationManager to
retrieve it by name or provider name.

--Mary

On Wed, 19 Apr 2006 08:51:48 +0200, "mortb" <mortb@nospam.nospam>
wrote:

>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?
>
date: Sat, 22 Apr 2006 19:39:12 -0400   author:   Mary Chipman [MSFT]

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us