Geeks With Blogs
Dennis Bottjer | MVP

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>

Posted on Friday, January 19, 2007 7:40 AM ASP.NET | Back to top


Comments on this post: ASP.NET Connection Strings Configuration

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © DennisBottjer | Powered by: GeeksWithBlogs.net