How to create a new subdomain site using the administration panel of an existing site

I am developing a site in asp.net MVC from which the administrator can create a subdomain of this site with different css and images, but with the same database.

For example, suppose I developed the site www.xyz.com, and the xyz.com administrator wants to create an additional domain, for example, http://sub.xyz.com/ Therefore, when the administrator places the subdomain name, then the application will create a new folder and the whole The code of the main copy of the site in this folder.

So, since asp.net is not open source, then someone can answer me some questions.

  • How to manage the assembly link between the primary site and the secondary domain.
  • How to register a subdomain at runtime.
  • The procedure for changing css and images after the publication of the project.
+3
source share
1 answer

Perhaps we will simplify the problem a little if you do not need your applications to run in separate application pools.

  • Create a wildcard mapping on your DNS server for all xyz.com subdomains to point to the same host.
  • Configure your web server to route all host names to the same website.
  • , , , - URL- , . , css images url. , :

    < link type = "text/css" rel= "stylesheet" href= "css/<% = Request.Url.Host% > /default.css" / >

    < img src= "images/<% = Request.Url.Host% > /header-logo.gif" / >

+1

Source: https://habr.com/ru/post/1716087/


All Articles