via http://forums.asp.net/t/874598.aspx
If your DNS provider (ie. ISP) have "wildcard" option you could set *.mydomain.com -> myIP
Next step.
Option #1
Make a script that creates 1 sites for each subdomain in IIS
Option #2
Make a url_rewrite script that rewrites urls to correct folder on-the-fly.
option 2 is probably what you are looking for (and is STRONGLY recommended and preferred to option 1).
more info about url rewriting on iis7: http://learn.iis.net/page.aspx/460/using-url-rewrite-module/
The Microsoft URL Rewrite Module for IIS 7.0 provides flexible rules-based rewrite engine >that can be used to perform broad spectrum of URL manipulation tasks, including, but not >limited to:
- Enabling user friendly and search engine friendly URL with dynamic web applications;
- Rewriting URL’s based on HTTP headers and server variables;
- Web site content handling;
- Controlling access to web site content based on URL segments or request metadata.
the url rewriting option makes it easy to have hundreds of thousands of companies, their names can be read from the database and a url rewrite will handle the redirects. after that you can forget about it (for the most part) as it will keep on working for all the companies signing up in the future as well.