"Wiktor Zychla" <ie****@microsoft.com.no.spam> wrote in message news:<uc**************@TK2MSFTNGP09.phx.gbl>...
Would System.Net.Dns class help you?
If you can help to show me the proper method or property of this class, I
would be grateful. I make a heavy use of Dns class and didn't find any way
to get the nameserver name.
You can use the System.Management methods:
class GetDNS
{
public static void Main()
{
ManagementObjectSearcher mos = new ManagementObjectSearcher(
"SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = 'TRUE'");
ManagementObjectCollection moc = mos.Get();
foreach(ManagementObject mo in moc)
{
Console.WriteLine("Network Card: {0}", mo["Description"]);
string[] hosts = (string[])mo["DNSServerSearchOrder"];
foreach(string host in hosts)
Console.WriteLine(" DNS host: {0}",host);
}
}
}
Hope this helps some.
Rich Blum - Author
"C# Network Programming" (Sybex)
http://www.sybex.com/sybexbooks.nsf/Booklist/4176
"Network Performance Open Source Toolkit" (Wiley)
http://www.wiley.com/WileyCDA/WileyT...471433012.html