Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm developping a multi-tenant web application in ASP.NET MVC and it will provide my users the ability to have a custom subdomain pointing to their account page (like user.myapp.com). I already have it working by using a wildcard DNS entry and a code to query the database to load the user data based on the domain.

I'm planning to offer the possibility of using custom domains, allowing the users to buy their own domains and use it instead of the subdomains that will be provided by default.

I currently use DNSMadeEasy to host the DNS for the application main domain.

I just don't know what kind of settings I must make to allow this feature to work, since the users will have domains hosted in several companies. Will I have to create my own nameservers and provide it to my users?

What other things I must consider to implement it efficiently?

share|improve this question

1 Answer 1

it should be a case of checking the host header :

string incomingUrl = Request.Url.Host;

switch (incomingUrl)
{
  case "user.domain.com":
    //Do your dynamic output here
    break;
  case "www.totallydifferentdomain.com":
    //Do your dynamic output here
    break;
}

Once you have some logic like that in your application then all you have to do is have your users set their DNS to point a CNAME to your server that way your server would see the Request.Url.Host value as being set to their domain name.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.