tags:

views:

143

answers:

1

I am developing a site in asp.net MVC, From which a admin can create a sub domain of that site with different css and images but same DataBase.

For eg: Suppose I have developed a site www.xyz.com, and admin of xyz.com want to create a sub domain like http://sub.xyz.com/ So when admin put a name of sub domain, Then application create a new folder and all the code of main site copy to that folder.

So, Because asp.net is not a open source code then could any one tell me the answer of some points.

  1. How to manage assembly reference between main site and sub domain.
  2. How to register sub domain during run time.
  3. Procedure of change css and images after publish a project.
+1  A: 

Perhaps we can simplify the problem a little if you don't need your applications to run in seperate application pools.

  • Create a wildcard mapping on your DNS server for all subdomains of xyz.com to point to the same host.
  • Configure your web server to route all hostnames to the same website.
  • Instead of copying the whole app to a new folder for each subdomain, modify the original app to behave differently depending on the host url used to call it. The modified behaviour might be as simple as changing the css & images folder depending on the url subdomain. For example your master page could contain lines like this:

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

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

grenade
Hello grenade,I am new to asp.net MVC. Please describe your answer in details. Thanks
Amit