4

I'm running IIS 7 on Windows 7 and would like to setup wildcard subdomains to test out an ASP.NET multi-tenant application that uses the subdomain to identify the user. How can I achieve this?

2
  • So you're wanting user.domain.com and user2.domain.com to be answered by the ASP.NET app such that user or user2 ID the user?
    – Taylor
    Jul 30, 2010 at 16:51
  • @Taylor - Yes (15 characters)
    – Omar
    Jul 30, 2010 at 17:35

1 Answer 1

7

Update 2016

IIS 10 in Windows 2016 supports wildcard host headers.

Origin answer

Unfortunately IIS 7 still doesn't support wildcard mappings for subdomains (or any part of the domain binding).

You have a few options:

  • If you can ensure the site only receives traffic on one IP and you own/have dedicated access to the server, you can use DNS to "fake" out the behavior with a wildcard mapping and no host. There is a great post on this at http://dirk.net/2008/05/28/wildcard-host-header-binding-and-subdomains-with-iis7

  • Simply let the site respond to all traffic, or all traffic using a supported binding, and let ASP.NET handle the subdomain processing. Basically everything hits IIS and ASP.NET, and then you use code for the sub-domain control. Your APP is at the root, and the subdomains and simply used by the app to obtain the user info.

  • Use some sort of traffic control/url-rewrite module to rewrite requests to user or user2.domain.com to just app.domain.com (or whatever) with some additional header (i.e. 'X-UserInfo') that contains the username, and your app handles the username that way

2
  • The link above is broken...do you know where I can read about this? Feb 2, 2015 at 19:47
  • Well actually I had done exactly the same thing before but now as there are some other sites on my server I wasn't able to create a website without host name but assigning a dedicated ip solved the problem (this one I didn't know) Thanks a lot Aug 17, 2015 at 18:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .