tags:

views:

295

answers:

3

The situation is, I have a website where the users get a sub domain. eg: client.mydomain.com. If the client fails to meet certain condition (eg. payment default), I want the above site to be pointing to a different web site. The way we want to do it is by creating a dns record with the appropriate redirection.

I use a win 2003 server, and program in .Net. any inputs on how I can programmatically do this?

I do control the website, however the reason is there are a lot of users (and hence sub domains) and also there is no physical website for (client.mydomain.come), it's like a wordpress/blogger where a user has blog.wordpress.com (and I assume they don't create a new website for each user).

+1  A: 

Well, using .Net and a windows 2003 server, you can do this using WMI scripting. You can find more information on the DNS WMI classes here

HOWEVER

I strongly recommend that you do not use a Windows server for a public DNS server - for security and performance reasons you are much better off using a linux server running BIND. In addition, using BIND-dlz (a add on for BIND), you can make BIND use almost any SQL database as a datasource for your DNS records. As of BIND 9.4, BIND-dlz is included in the core BIND distribution. More information can be found at http://bind-dlz.sourceforge.net

Lokkju
A: 

Shouldn't it be possible to map *.domain.com to your server-ip and then from your app configure the host-binding? that way you will use the same app for all users. Otherwise, you can always check the host yourself and redirect, switch webroot etc or whatever you want.

jishi
A: 

If you control the website, I think that best would be to setup redirections instead of changing DNS records. The redirection could be as simple as renaming the current document index (say, index.htm) for one of your own that'll do a meta redirect to the destination.

DNS changes are slow to propagate, so there will be delays in the disabling and also in the enabling, even with small TTL. The other change is easier and immediate.

Vinko Vrsalovic