views:

131

answers:

1

Hi,

I want to create a multi-tenant application that uses the hostname to determine the customer.

For example:

CustomerOne.myapp.com AnotherCo.myapp.com AndOneMore.myapp.com ...

I can do the database and security side with no problems, I can also get the hostname from the URL, but what I am struggling to find out is how to create the basic plumbing that would allow a new customer to sign up online, provide their company name, and for the application to create the new URL, ready to be used straight away.

Can anyone help?

Thanks,

Rob.

A: 

I can't answer this exactly, but I can break it down a little bit.

To set up a new generic subdomain something.myapp.com you'll need to do two things:

1) Programmatically add some new DNS entries via your ISP so that something.myapp.com points to your web server.

2) Programmatically set the local bindings in IIS so that something.myapp.com gets directed to the right website/virtual directory/application

There is some discussion of setting IIS binding programmatically here, which also links through to this forum post here, which mentions that appcmd.exe can be used to set IIS config at run time.

Hope this points you in the right direction ...

codeulike
OK, it's going to be harder than I thought :-(Thanks for the response.
Wizzarding