Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old September 4th, 2007, 04:15 AM
Registered User
Join Date: Sep 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Modifying in-memory connection string


I need to deploy data driven web sites for dozens of clients. Each client will have their own URL and their own SQL Server database, but the actual code (.aspx files, .aspx.cs files, .gif files, etc.) of each site is exactly the same. Obviously, I don't want to duplicate the code for each site.

I'm thinking of using this solution:
* Have just one directory with all the files, including the web.config, and point all URLs to that one directory.
* Have a separate database for each site, with the same name as its URL - so the site "bigclient.com" would have database "bigclient.com", etc.
* Do something clever in the Global.asax, so when a site starts up it changes its cached connection string - to make it use the database matching the url of the site.

I know how to change the connection string in the web.config file. However, because there would be only one web.config, if one site updated the web.config file with its connection string, this would affect all other sites. So I want to update the in-memory connection string only, not the actual web.config file.

I could change the code so all sites use the one database, and add a "url" field to all tables. However, this would be a lot of work. I'd much prefer to have each site change its own in-memory connection string on startup if possible.

How do I do this?
Is there a better way of solving the "1 set of source files, multiple databases" problem?

Thanks in advance for your help,

Matt Perdeck

Similar Threads
Thread Thread Starter Forum Replies Last Post
Connection string bex BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 4 August 3rd, 2008 02:16 PM
Connection String jmss66 Oracle 4 August 8th, 2006 03:19 AM
Connection String fs22 Classic ASP Databases 3 August 30th, 2004 01:25 AM
Connection String phungleon Dreamweaver (all versions) 1 February 11th, 2004 05:14 AM
connection string aadz5 ASP.NET 1.0 and 1.1 Basics 4 October 20th, 2003 08:43 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.