Export (0) Print
Expand All
5 out of 9 rated this helpful - Rate this topic

Dns Class

Provides simple domain name resolution functionality.

Namespace:  System.Net
Assembly:  System (in System.dll)
public static class Dns

The Dns type exposes the following members.

  NameDescription
Public methodStatic memberBeginGetHostAddressesAsynchronously returns the Internet Protocol (IP) addresses for the specified host.
Public methodStatic memberBeginGetHostByName Obsolete. Begins an asynchronous request for IPHostEntry information about the specified DNS host name.
Public methodStatic memberBeginGetHostEntry(IPAddress, AsyncCallback, Object)Asynchronously resolves an IP address to an IPHostEntry instance.
Public methodStatic memberBeginGetHostEntry(String, AsyncCallback, Object)Asynchronously resolves a host name or IP address to an IPHostEntry instance.
Public methodStatic memberBeginResolve Obsolete. Begins an asynchronous request to resolve a DNS host name or IP address to an IPAddress instance.
Public methodStatic memberEndGetHostAddressesEnds an asynchronous request for DNS information.
Public methodStatic memberEndGetHostByName Obsolete. Ends an asynchronous request for DNS information.
Public methodStatic memberEndGetHostEntryEnds an asynchronous request for DNS information.
Public methodStatic memberEndResolve Obsolete. Ends an asynchronous request for DNS information.
Public methodStatic memberGetHostAddressesReturns the Internet Protocol (IP) addresses for the specified host.
Public methodStatic memberGetHostByAddress(IPAddress) Obsolete. Creates an IPHostEntry instance from the specified IPAddress.
Public methodStatic memberGetHostByAddress(String) Obsolete. Creates an IPHostEntry instance from an IP address.
Public methodStatic memberGetHostByName Obsolete. Gets the DNS information for the specified DNS host name.
Public methodStatic memberGetHostEntry(IPAddress)Resolves an IP address to an IPHostEntry instance.
Public methodStatic memberGetHostEntry(String)Resolves a host name or IP address to an IPHostEntry instance.
Public methodStatic memberGetHostNameGets the host name of the local computer.
Public methodStatic memberResolve Obsolete. Resolves a DNS host name or IP address to an IPHostEntry instance.
Top

The Dns class is a static class that retrieves information about a specific host from the Internet Domain Name System (DNS).

The host information from the DNS query is returned in an instance of the IPHostEntry class. If the specified host has more than one entry in the DNS database, IPHostEntry contains multiple IP addresses and aliases.

The following example queries the DNS database for information on the host www.contoso.com.


IPHostEntry hostInfo = Dns.GetHostByName("www.contoso.com");
   


.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.