This topic has not yet been rated - Rate this topic

Dns Class

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Provides simple domain name resolution functionality.

System.Object
  System.Net.Dns

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

The Dns type exposes the following members.

  Name Description
Public method Static member BeginGetHostAddresses Asynchronously returns the Internet Protocol (IP) addresses for the specified host.
Public method Static member BeginGetHostByName Obsolete. Begins an asynchronous request for IPHostEntry information about the specified DNS host name.
Public method Static member BeginGetHostEntry(IPAddress, AsyncCallback, Object) Asynchronously resolves an IP address to an IPHostEntry instance.
Public method Static member BeginGetHostEntry(String, AsyncCallback, Object) Asynchronously resolves a host name or IP address to an IPHostEntry instance.
Public method Static member BeginResolve Obsolete. Begins an asynchronous request to resolve a DNS host name or IP address to an IPAddress instance.
Public method Static member EndGetHostAddresses Ends an asynchronous request for DNS information.
Public method Static member EndGetHostByName Obsolete. Ends an asynchronous request for DNS information.
Public method Static member EndGetHostEntry Ends an asynchronous request for DNS information.
Public method Static member EndResolve Obsolete. Ends an asynchronous request for DNS information.
Public method Static member GetHostAddresses Returns the Internet Protocol (IP) addresses for the specified host.
Public method Static member GetHostAddressesAsync
Public method Static member GetHostByAddress(IPAddress) Obsolete. Creates an IPHostEntry instance from the specified IPAddress.
Public method Static member GetHostByAddress(String) Obsolete. Creates an IPHostEntry instance from an IP address.
Public method Static member GetHostByName Obsolete. Gets the DNS information for the specified DNS host name.
Public method Static member GetHostEntry(IPAddress) Resolves an IP address to an IPHostEntry instance.
Public method Static member GetHostEntry(String) Resolves a host name or IP address to an IPHostEntry instance.
Public method Static member GetHostEntryAsync(IPAddress)
Public method Static member GetHostEntryAsync(String)
Public method Static member GetHostName Gets the host name of the local computer.
Public method Static member Resolve 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.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8 Consumer Preview, Windows Server 8 Beta, Windows 7, Windows Server 2008 SP2, Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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)