IPGlobalProperties.HostName Property

Gets the host name for the local computer.

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

public abstract string HostName { get; }
/** @property */
public abstract String get_HostName ()

public abstract function get HostName () : String

Not applicable.

Property Value

A String instance that contains the computer's NetBIOS name.

Exception typeCondition

NetworkInformationException

A Win32 function call failed.

A computer's NetBIOS name must be unique within a network and is not fully qualified by the domain name.

The following code example displays network information for the local computer.

IPGlobalProperties properties = IPGlobalProperties.GetIPGlobalProperties();
Console.WriteLine("Computer name: {0}", properties.HostName);
Console.WriteLine("Domain name:   {0}", properties.DomainName);
Console.WriteLine("Node type:     {0:f}", properties.NodeType);
Console.WriteLine("DHCP scope:    {0}", properties.DhcpScopeName);
Console.WriteLine("WINS proxy?    {0}", properties.IsWinsProxy);

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions

ADD
Show: