views:

218

answers:

2

Hi,

How is it possible to create a subdomain for each registered user of the web-site during the registration?
For the scenario below...

  1. User opens site.com/register.
  2. Provides details and submits.
  3. Gets redirected to the newuser.site.com straight away
  4. User can work in the newuser.site.com area

I don't know how to solve the issues:

  1. Create and propagate a subdomain for the user.
  2. Have the single ASP.NET application to handle all subdomains and the main domain.
  3. Configuraton of IIS.

Ideally I would like to stay withing .NET Framework as much as possible.

+1  A: 

Take a look here: http://www.seoconsultants.com/windows/isapi/subdomains/

Noon Silk
I assume if I will set up ISAPI_Rewrite to rewrite *newuser.site.com* to *site.com/newuser* I can have one application to handle all the requests. And IIS is configured only once. It could do the job.
Dmytrii Nagirniak
+3  A: 

You might approach it like this:

  1. First, establish a wildcard DNS domain (*) for your site's IP address. That will allow anystring.yourdomain.com to resolve correctly.
  2. Configure IIS to bind to a dedicated IP address, but not to rely on host headers (have an empty host header). That will cause all HTTP requests for the bound IP to be directed to your site.
  3. Have an HttpModule that looks at the incoming domain (in HttpContext), and rejects it if it's not valid. You might consider setting a cookie or ticket or something like that, to avoid the need to do a DB lookup for each request in order to validate it.
RickNZ