Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

IPGlobalProperties.HostName Property

Note: This property is new in the .NET Framework version 2.0.

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

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 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 .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0

Community Additions

ADD
Show:
© 2015 Microsoft