Provides simple domain name resolution functionality.
For a list of all members of this type, see Dns Members.
[Visual Basic] NotInheritable Public Class Dns [C#] public sealed class Dns [C++] public __gc __sealed class Dns [JScript] public class Dns
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 www.contoso.com:
[Visual Basic] Dim hostInfo As IPHostEntry = Dns.GetHostByName("www.contoso.com") [C#] IPHostEntry hostInfo = Dns.GetHostByName("www.contoso.com"); [C++] IPHostEntry* hostInfo = Dns::GetHostByName(S"www.contoso.com");
[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button in the upper-left corner of the page.
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:
- DnsPermission to allow the use of Dns.