views:

220

answers:

2

I would like to know if it is possible using IIS and ASP.NET (and ideally something that might be employed on a shared hosting account, but this isn't required) to mimic WordPress.com's ability to allow end users to use their own domain names.

WordPress has users who own their own domains change the domain's DNS settings to point to WordPress's own DNS. My guess is this is not something that would be able to be done on a shared hosting account since it would involve adding an entry to the DNS server's table for each custom user domain.

However, for future reference, is this something that might be automated programmatically on perhaps a VPS?

A: 

What we do is have a wildcard DNS entry set up for our domain. That way, whatever domain the user types will resolve to our website as long as it ends with ".mydomain.com". Then our .Net code just looks at the "HOST" header coming in and serves up the content that matches that domain name.

David
This is another thing I would like to do, but right now I'm curious about supporting completely custom domain names owned by users.
chaiguy
+1  A: 

My guess is this is not something that would be able to be done on a shared hosting account

You're nearly correct. The default site in IIS listens to all connections on port 80 for the default IP address.

You can add more sites in 3 ways:

  1. Add new sites listening on different ports. This is not entirely practical if you want "ordinary" sites litening on port 80.

  2. Add more IP addresses to the box (not too eaisly done) and set up new IIS sites to listen to the new IP addresses independently.

  3. Add new sites to the server listening to different "host headers" (domain names to you and I) but on the same (default) IP address .

So called "Shared hosting" usually uses options 3, because a hosting company can get away with only using a single IP address for possibly hundreds of sites. Therefore you would have to go through the tedious process of adding each host header to the box, and while I'm almost certian this could be done with Wscript, I'm no expert in that area.

If you really wanted to get into it, you could write an ISAPI module to intercept the calls and set up some clever (ish) database/hash table of domain names and target folders to server as the different sites.

Bottom line is, there are various ways to achieve this on Windows. Probably none quite as easy as on a *nix platform where everything is super-scriptable.

Greg B
No doubt it's going to be harder on Windows, but just possible is enough for me right now.I just set up a EC2 account and am wondering if this will give me the ability to do this, however I know very little at this point. Will a Windows-based EC2 enable me to control IIS in the ways you mention?
chaiguy
I'm afraid I have no experience with EC2 but from what I gather it's just somewhere to run a "standard" web application from. What you're talking about excedes the limits of "standard". I think you're going to need to look into some dedicated hosting to achive this.
Greg B
Ok thanks. I'll keep fiddling with EC2 anyway--I might as well learn how to use it. :)
chaiguy