Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5949303
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:13:47+00:00 2026-05-22T17:13:47+00:00

I have two web sites in IIS like http://domainA.com http://domainB.com I would like to

  • 0

I have two web sites in IIS like

http://domainA.com 
http://domainB.com 

I would like to use the same code for these web sites but a different web.config files. Is this possible? I store database connectionstrings etc in the web.config files, all the other code in the applications are the same.

I have tried some different approches with creating a folder structure like

-Root
  - Domain A
    - web.config for domain A
    - Code
      - Virtual Directory to Source Code  
  - Domain B
    - web.config for domain B
    - Code 
      - Virtual Directory to Source Code
- Source Code

I will then point the website for domain A to “Root/Domain A” and domain B to “Root/Domain B” but the problem is then that the code must be accessed one level down, like

http://domainA.com/Code/
http://domainB.com/Code/

Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T17:13:52+00:00Added an answer on May 22, 2026 at 5:13 pm

    I will base my answer on the assumption that you are writing custom code rather than using an out of the box solution such as DNN or SharePoint.

    One solution that comes to mind to keep a common code base is to maintain your website specific configuration settings in your database instead of the web.config. You can keep your database structure fairly dynamic by using a set of name/value pairs. You would of course need to take this into account in the design of your application and plan for it in your database. This gives you the advantage of only having a single code base as well as a single web.config. If you need to maintain content in separate databases for each site, the connection string info to those content databases can be one of the name/value pairs in your configuration database.

    You can even take this one step further by having a single website in IIS for all domains as well (unless you will be using SSL, in which case separate IIS sites would be better). You would need to add host headers to the website and then look for the host header in your code to determine what settings to use and what content to serve. You would lose the ability to create separate app pools so you should check your requirements if this is a feasible option for your situation.

    This is actually a similar model to how both DNN and SharePoint work but can certainly be done in a custom application as well.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two web applications in the same server like this: /basedir/app1path/default1.aspx /basedir/app2path/default2.aspx How
We have two subdomains for the same site, we would like that depending on
I have two exactly the same web sites hosted in two different machines under
I have two websites: http://example.com http://example.com/sub I have a page, let's say: http://example.com/sub/page1 Is
I have two web applications running in the same Tomcat Instance. In one of
I have two websites running on the same IIS instance on the same 2008
I've two web sites running on my IIS 7.5. Both on port 80. Since
I have two IIS websites, namely accounts.example.com that was created in Visual Studio 2010
I have two websites hosted on the same IIS server. SiteA contains WCF services
I have two IIS sites pointing to diffent physical folders. This is to be

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.