HttpServerUtility.MachineName Property


Gets the server's computer name.

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

public string MachineName {
	[AspNetHostingPermissionAttribute(SecurityAction.Demand, Level = AspNetHostingPermissionLevel.Medium)]

Property Value

Type: System.String

The name of the local computer.

Exception Condition

The computer name cannot be found.

The following example stores the server's computer name as a string variable.

String ThisMachine;
ThisMachine = Server.MachineName;

.NET Framework
Available since 1.1
Return to top