Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
    
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 '10 at 16:51
    
@Taylor - Yes (15 characters) –  Omar Jul 30 '10 at 17:35

1 Answer 1

up vote 5 down vote accepted

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.