Dns Class
Provides simple domain name resolution functionality.
For a list of all members of this type, see Dns Members.
System.Object
System.Net.Dns
[Visual Basic] NotInheritable Public Class Dns [C#] public sealed class Dns [C++] public __gc __sealed class Dns [JScript] 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.
Remarks
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.
Example
[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.
Requirements
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:
- DnsPermission to allow the use of Dns.