Dns.GetHostName Method ()

 

Gets the host name of the local computer.

Namespace:   System.Net
Assembly:  System (in System.dll)

static member GetHostName : unit -> string

Return Value

Type: System.String

A string that contains the DNS host name of the local computer.

Exception Condition
SocketException

An error is encountered when resolving the local host name.

The following example uses the GetHostName method to obtain the host name of the local computer.

No code example is currently available or this language may not be supported.

DnsPermission

for accessing DNS information. Associated enumeration: PermissionState.Unrestricted

.NET Framework
Available since 1.1
Return to top
Show: