Queries DNS for address information about the specified host.
- hostName
- A string containing the DNS name of the host.
A System.Net.IPHostEntry object containing host information for the address specified in hostName .
Type Reason System.Net.DnsPermission Requires unrestricted permission for accessing DNS information. See System.Net.DnsPermission and System.Security.Permissions.PermissionState.Unrestricted.
Type Reason ArgumentNullException hostName is null . System.Net.Sockets.SocketException An error was encountered executing the DNS query . System.Security.SecurityException The caller does not have permission to access DNS information.
Note:To retrieve host information asynchronously, use the Dns.BeginGetHostByName(string, AsyncCallback, object) and Dns.EndGetHostByName(IAsyncResult) methods.
See the System.Net.IPHostEntry class page for an example that uses the Dns.GetHostByName(string) method.
Namespace: System.Net
Assembly: System (in System.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0