1: public static bool CheckDNS(string domain)
2: {3: bool result = false;
4: try
5: { 6: IPAddress[] addressList = Dns.GetHostAddresses(domain); 7: 8: result = addressList.length > 0 ? true : false;
9: }10: catch
11: {12: result = false;
13: } 14: }For testing you can pass an existed domain name such as www.technolatte.net and pass a domain name which doesn't exist.
CheckDNS("www.technolatte.net"); //output is true
CheckDNS("www.thisistestdomainname.com"); //output is false