0

I am going to get DNS server situation (upping or downing) in asp.net and I could get server's IP address but I couldn't implement DNS server's situation!

Here is my code that get IP address.

NetworkInterface[] adapters = NetworkInterface.GetAllNetworkInterfaces();
foreach (NetworkInterface adapter in adapters)
{
    IPInterfaceProperties adapterProperties = adapter.GetIPProperties();
    IPAddressCollection dnsServers = adapterProperties.DnsAddresses;
    if (dnsServers.Count > 0)
    {                    
        txtAdapterdescription.Text += adapter.Description;
        foreach (IPAddress dns in dnsServers)
        {
            txtDNSserverbox.Text += dns.ToString();
        }
    }
}

Anyone can help me to implement DNS server's situation?

Thanks

Waqas Raja
  • 10,802
  • 4
  • 33
  • 38
Javad
  • 41
  • 1
  • 2
  • 6
  • possible duplicate of [Getting the IP address of server in ASP.NET?](http://stackoverflow.com/questions/646525/getting-the-ip-address-of-server-in-asp-net) – xmojmr Nov 23 '14 at 15:55
  • Describe in more detail what you mean by "DNS server situation". Server's DNS records either exists or not and their values cached across the internet are valid (up-to-date) or not. What is the expected result your function should return? Do you get an error message? (See also [on-topic bullet #1](http://stackoverflow.com/help/on-topic) and http://stackoverflow.com/help/mcve) – xmojmr Nov 25 '14 at 14:36

0 Answers0