Back to list
Views:   24.6K
Replies:  1

Programmatically create subdomains on IIS with ASP.NET MVC

So, here are my requirements. I am building a multi-tenant site where companies after they sign up get their own subdomain.
Assume that my business is called Email Jobs Inc with domain  This site is hosted in a shared ISP environment so I have very limited access to IIS etc.

Just to clarify, here is an example of what I need:

company1 signs up and they get this url
company2 signs up and they get this url
company3 signs up and they get this url:

My understanding is that there is a DNS and IIS component to this. That is, I will need to change an entry in a DSN server and then also a binding in IIS.  All this is very tricky, because of non-static IP addresses, etc. etc.

However, another option I heard of is to ask your ISP to setup an IIS wildcard option where * goes straight to my ASP.NET MVC server. There I can parse the URL, extract the subdomain and I would be in business!  Right?  

Could someone confirm that this is possible and correct? 

I realize that another option I have is to build urls like this: etc, but that would be far less elegant.
Any feedback would be greatly appreciated...


Ian Barrymore, Apr 18, 2011
Reply 1
I guess you are on right track...see this for setting up zone at DNS server using wildcard

this way you get all incoming requests for and so on to a specific website created on IIS - make sure you dont have host header with website name and only with IP address.

And use IIS redirect or MVC or traditional web form to intercept request at code level and serve request...

Happy programming
Saurin Travadi, Apr 21, 2011
Stay Inspired!
Join other developers and designers who have already signed up for our mailing list.
Terms     Privacy     Cookies       Do Not Sell       Licensing      
Made with    in Austin, Texas.  - vsn 44.0.0
© Data & Object Factory, LLC.