I'm working on a new "secret" project web site with a friend of mine. One of the features we want to implement on the site is the ability to enter a sub-domain as a search/filter of sorts for the site. There are two different elements that come in to play when implementing a feature like though (well three when you count the programming on the site itself): DNS, and IIS.
It turns out that both are actually trivial...
To implement a wildcard sub-domain using Microsoft DNS it is as simple as adding an A record for your given domain where the hostname is '*' (no quotes).
To implement a wildcard sub-domain using Microsoft IIS requires a dedicated IP address for the site. Open IIS Manager, find your website, right-click and then click on Properties. on the "Web Site" tab of the properties window that opens up, click the "Advanced" button. Typically there should only be a single entry, so you might need to edit it. Make sure an IP address for the server is selected (instead of "All Unassigned"), and that there is no "Host header value" defined.
And for those programming in VB.NET, if you'd like to know what the user entered as their URL once they reach your site, you can use Request.Url.Host to determine the requested hostname, which you'll then have to parse off the first part to get your search term.