Can anyone tell me how to programmatically retrieve the cname and mx records from an internet domain(www.example.com) using c#?
According to my short research, I understand it’s possible by using UDP socket probe to the DNS server, BUT, is it possible to achieve that without knowing the DNS server address, only the domain name like “www.example.com”?
I think it’s possible because I’ve been using some 3rd-party free toolkit to get MX records successfully, without knowing the DNS server address.
Thx a lot
I haven’t tried the libraries mentioned above, but the I would consider using services instead of libraries. I don’t know what’s the desired use-case, but you can deliver this functionality even on asp.net web application, cross-platform mobile application or mobile website.
You can process this HTML, but Yahoo can do is dirty job for you using YQL html processor and return the relevant part in XML or JSON.
select * from html where url=”YOUR PARAMETRIC DNS URL” and
xpath=’XPATH QUERY TO ACCESS NS OR MX RECORD IN THE RESULT HTML’
Pros:
-your application can be very lightweight
Cons:
-the HTML structure of the result page can be changed or DNSWatch can refuse your request after over-using resources.
Nevertheless you can implement the working prototype in 1 hour.