Creating DNS records programmatically

The situation is that I have a site where users get an additional domain. for example: client.mydomain.com. If a customer doesn't meet certain conditions (like default payment), I want the above site to point to a different website. The way we want to do this is to create a dns entry with the appropriate redirection.

I am using a win 2003 server and a program in .Net. any data on how i can programmatically do this?

I manage the website, however the reason is that there are many users (and therefore subdomains) and also no physical site for (client.mydomain.come), this is similar to wordpress / blogger where the user has blog.wordpress .com (and I'm assuming they don't create a new site for every user).

+1


source to share


4 answers


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



+1


source


Well, using .Net and Windows 2003 server you can do it with WMI scripts. You can find more details on DNS WMI classes here

HOWEVER



I highly 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. Also, using BIND-dlz (addon for BIND), you can make BIND almost any SQL database as the data source for your DNS records. Since BIND 9.4, BIND-dlz is included in the main BIND distribution. More information can be found at http://bind-dlz.sourceforge.net

+1


source


If you are in control of the website, I think it is best to set up redirects instead of changing DNS records. A redirect can be as simple as renaming the document's current index (say index.htm) to one of your own, which will meta-redirect to the destination.

DNS changes are slow to propagate, so there may be delays in shutdown as well as startup, even with a small TTL. Another change is simpler and more urgent.

0


source


Use a service like Amazon AWS Route 53 for your DNS, then you can programmatically use your API to add / remove / modify DNS records.

0


source







All Articles