Dennis Bottjer | ASP.NET + SharePoint Architect, Trainer & Speaker

"An Ounce of Prevention is Worth a Pound of Cure" - Ben Franklin
posts - 168, comments - 59, trackbacks - 41

My Links

News

Add to Technorati Favorites The views expressed in this blog are mine and mine alone, not that of my employer, Microsoft, or anyone else’s. No warrantee is given for the quality of any material on this site.

Tag Cloud

Archives

Post Categories

ASP.NET Connection Strings Configuration

ASP.NET 2.0 introduced a new connection strings section to the web.config.  All connection strings can be centralized in this one section making tasks like connection string encryption easier.  [Dave] recently showed me how to remove the connection strings from the web.config and place the entire connection string section in another config file.  This connections.config is then referenced from within the web.config.  This is a nice technique when maintaining several applications that connect to the same databases.  A connections.config file can be versioned and then referenced by the application as basically a library or include.  See the code below as an example.

<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<appSettings configSource="appSettings.config"/>
  <connectionStrings configSource="connections.config"/> 
   <system.web>
      <compilation debug="true" />
      <authentication mode="Windows"/>
      <identity impersonate="true"/>
   </system.web>
</configuration>

Print | posted on Friday, January 19, 2007 7:40 AM | Filed Under [ ASP.NET ]

Comments have been closed on this topic.

Powered by: