I am trying to programmatically check if a given domain name exists.
The following line of code works as expected:
IPHostEntry IPhst =Dns.GetHostEntry("google.com");
But it does not work for multiple domains on the same host at the same time. For example, the following excludes.
IPHostEntry IPhst =Dns.GetHostEntry("bks-campus.ch");
The resulting exception is identical to the exceptions that are thrown when the domain name does not exist at all.
It is strange that the domain really exists. I can view it from the same machine that just ran the code above.
What could be the problem here and how can I get around this?
Edit: Dig also agrees that this domain name really exists:
dig bks-campus.ch ; <<>> DiG 9.5.0-P2 <<>> bks-campus.ch ;; global options: printcmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 14744 ;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0 ;; QUESTION SECTION: ;bks-campus.ch. IN A ;; AUTHORITY SECTION: bks-campus.ch. 3600 IN SOA dns1.bks-campus.ch. hostmaster.kanti-chur.ch. 1275546863 10800 3600 604800 86400 ;; Query time: 1214 msec ;; SERVER: 192.168.0.1#53(192.168.0.1) ;; WHEN: Fri Jul 2 12:50:10 2010 ;; MSG SIZE rcvd: 94
source share