title: customising web.config based on domain name
body: <p>Most of my websites include one LIVE (production) and two TEST environments which are accessible via three different domain names e.g.</p>
  
  <pre><code>www.mysite.com
  test1.mysite.com
  test2.mysite.com
  </code></pre>
  
  <p>Each of the above are IIS Websites which point to the same physical <strong>versioned</strong> folder when they are all running the same version of the website.</p>
  
  <p>What I typically do when releasing a new version is to place the new version into a new physical folder e.g. <strong>/inetpub/wwwroot/mywebsite/v41/</strong> and point one of the TEST sites to that version of the site and test it.  Once passed, the LIVE (and other TEST) websites are also repointed to the new version (e.g. v41).</p>
  
  <p>Now my problem is this.  Each website has its own database (TESTs have a copy of LIVE which can be refreshed via a couple of SQL BACKUP/RESTORE commands) however, the three sites are all "looking" at the same web.config file and therefore the same Database Connection Strings (either a System.Data.SqlClient or System.Data.EntityClient provider).</p>
  
  <p>Is there <strong>any</strong> way that I can configure web.config to provide different <strong>connectionStrings</strong> based on the domain name/IIS website of the incoming request?</p>
  
  <p>Maybe a  tag or an attribute that qualifies a given tag?</p>
  
  <p>I've looked all over for a solution but not yet found one.
  Thanks in advance,
  BloodBaz</p>