I think the way to do this is to make the site the default website on the server, that is, configure so that all requests for the server’s IP addresses fall on this site (unless the header matches another site that is explicitly looking for it). You do this without specifying a title in IIS settings (only IP address and port number). You can do this for only one host on each IP address / port combination on the server.
Then look at the request URL on the website to determine which domain was requested.
Thus, there is no need to create “subdomains” ... but you need to reject the entire request to a domain that you do not want to recognize.
If you cannot do this, you need to configure the IIS metabase from the application - not impossible - but a very risky and probably bad idea.
James gaunt
source share