|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Programatically find the configured DNS serverI have some c# code to perform DNS lookups but currently need to provide the
IP address of the DNS server it uses. I would like to be able to identify the addres of the currently configured DNS server(s) and use this so that the app will effectively configure itself. Can anyone please tell me how I can do this, I know with .NET 2.0 and the System.Net namespace Dns is available that can provide the IP address / hostname of the system, but I need more than just this - I want the DNS server. Thanks in advance, -- Shaun Venus Hello, BLsunev!
B> Can anyone please tell me how I can do this, I know with .NET 2.0 and B> the System.Net namespace Dns is available that can provide the IP B> address / hostname of the system, but I need more than just this - I B> want the DNS server. use WMI, make a query for Win32_NetworkAdapterConfiguration class. DNSHostBName will contain the information you need... Take a look at ( http://www.codeproject.com/csharp/ObaFindingIPInformation.asp ) BLsunev wrote:
> I have some c# code to perform DNS lookups but currently need to provide the In Dotnet2,> IP address of the DNS server it uses. I would like to be able to identify > the addres of the currently configured DNS server(s) and use this so that the > app will effectively configure itself. > > Can anyone please tell me how I can do this, I know with .NET 2.0 and the > System.Net namespace Dns is available that can provide the IP address / > hostname of the system, but I need more than just this - I want the DNS > server. > > Thanks in advance, > the namespace "System.Net.NetworkInformation" also provides classes to easy access the network information. There is a full sample in Dotnet2 SDK. http://msdn2.microsoft.com/en-us/library(d=robot)/2xatedhd.aspx -- Jacky Kwok jacky@alumni_DOT_cuhk_DOT_edu_DOT_hk jacky@compose_DOT_com_DOT_hk Hi Shaun,
Welcome to MSDN Newsgroup! I hope the following article is also helpful for you: Title: C# .NET DNS query component URL: http://www.codeproject.com/csharp/dnslookupdotnet.asp Best Regards, Terry Fei [MSFT] Microsoft Community Support Get Secure! www.microsoft.com/security -------------------- Show quote >Thread-Topic: Programatically find the configured DNS server >thread-index: AcY3w2GhYTAJzQ1WQgaUkhdBCImaYA== >X-WBNR-Posting-Host: 217.196.245.2 >From: "=?Utf-8?B?QkxzdW5ldg==?=" <sunev@nospam.nospam> >Subject: Programatically find the configured DNS server >Date: Wed, 22 Feb 2006 07:19:32 -0800 >Lines: 14 >Message-ID: <5E511751-B2B6-4360-9B6A-9AAB768F3***@microsoft.com> >MIME-Version: 1.0 >Content-Type: text/plain; > charset="Utf-8" >Content-Transfer-Encoding: 7bit >X-Newsreader: Microsoft CDO for Windows 2000 >Content-Class: urn:content-classes:message >Importance: normal >Priority: normal >X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0 >Newsgroups: microsoft.public.dotnet.framework >NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250 >Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl >Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.dotnet.framework:109057 >X-Tomcat-NG: microsoft.public.dotnet.framework > >I have some c# code to perform DNS lookups but currently need to provide the >IP address of the DNS server it uses. I would like to be able to identify >the addres of the currently configured DNS server(s) and use this so that the >app will effectively configure itself. > >Can anyone please tell me how I can do this, I know with .NET 2.0 and the >System.Net namespace Dns is available that can provide the IP address / >hostname of the system, but I need more than just this - I want the DNS >server. > >Thanks in advance, > >-- >Shaun Venus > |
|||||||||||||||||||||||