views:

92

answers:

1

I am curious as to how companies such as Google App Engine, Weebly, ThinkTank allow clients to host their domains such as stackquestion.com to their application website such as stackquestion.stackapplication.com?

An Example with Weebly which uses A Records: http://www.weebly.com/support/index.php?pg=kb.page&id=4

Google App Engine uses CNAME Records.

Are there differences in the approach? Are there any limitations of using one over the other?

It is exactly like the question here: http://stackoverflow.com/questions/968173/how-do-i-allow-users-to-map-their-domains-to-a-url-on-my-site but would it be possible to outline what needs to be done from the application side (ASP.NET MVC) and the server side (IIS)?

A: 

At IIS 7:
- Create Web site, put your application to Root.
- Then create several bindings to your website, i.e. stackquestion.stackapplication.com port 80, anotherthing.stackapplication.com port 80
- In case if you need more domain names, you should use wildcards in bindings like *.stackapplication.com, which is little bit tricky: http://dirk.net/2008/05/28/wildcard-host-header-binding-and-subdomains-with-iis7/

At your controller:
-Then in Login controller you may check from which subdomain user is connecting, something like:

public string GetSubDomain()
{
    return Request.Url.Host.Split('.')[0];
}
Andrey Tkach