This documentation is archived and is not being maintained.

Dns Class

Provides simple domain name resolution functionality.

For a list of all members of this type, see Dns Members.


[Visual Basic]
NotInheritable Public Class Dns
public sealed class Dns
public __gc __sealed class Dns
public class Dns

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.


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.


[Visual Basic, C#, C++] The following example queries the DNS database for information on the host

[Visual Basic] 
Dim hostInfo As IPHostEntry = Dns.GetHostByName("")

IPHostEntry hostInfo = Dns.GetHostByName("");

IPHostEntry* hostInfo = Dns::GetHostByName(S"");

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.


Namespace: System.Net

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

Assembly: System (in System.dll)

.NET Framework Security: 

See Also

Dns Members | System.Net Namespace