Skip to content

Sunday, November 29th, 2009

Using Multiple Connections for ASP.NET Development

June 21, 2009 by Jason Bean  
Filed under Computers

This may not be a tip that’s too outstanding for everyone, but I’ve recently started employing the tweak to help me in my web development tasks. One of the challenges for me in development is that the data source for my web pages may change depending on my location on specific testing need. This tip shows you how to easily manage those changes on the fly.

setting-webconfig-connections

Depending on the situation, I could be working on the development of a website while working completely off a local copy of the database. Later I may need to point the web pages to a different database for testing that could be on one of the other corporate machines. Lastly, I could need to point the development to the live production server.

I used to accomplish this by having multiple versions of the web.config file that would point to each location. Now instead I add all the connection strings into a single web.config file and then comment out all of those that I’m not using.

I use Microsoft Visual Web Developer 2008 Express as my development tool and I can easily manage the web.config file internally and use one-click toolbar buttons to comment or uncomment out portions of the code.

Now I don’t have to worry about maintaining multiple web.config files and making sure I mirror any changes in one with all the others. Now I just use one file and have all the connection strings available at anytime as needed.

Image: Screen capture of web.config development interface
  • StumbleUpon
  • Digg
  • Facebook
  • Mixx
  • Google
  • TwitThis
  • Reddit
  • Yahoo! Buzz
  • Slashdot
  • E-mail this story to a friend!
  • BallHype
  • YardBarker

Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!


About Us | Advertise with us | Blog for EveryJoe | Privacy Policy | Terms of Use
Get This Theme | Sitemap


All content is Copyright © 2005-2009 b5media. All rights reserved.