Share via


SPWebServer.Name Property

Gets the name of the Web server.

Namespace:  Microsoft.SharePoint.Administration
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No

Syntax

'Declaration
Public ReadOnly Property Name As String
    Get
'Usage
Dim instance As SPWebServer
Dim value As String

value = instance.Name
public string Name { get; }

Property Value

Type: System.String
A string that contains the name of the Web server.

Examples

The following code example from a console application uses the Name property to display the name of each Web server in the SharePoint Foundation deployment.

Dim globalAdmin As New SPGlobalAdmin()
Dim webServers As SPWebServerCollection = globalAdmin.Config.WebServers
Dim webServer As SPWebServer

For Each webServer In  webServers
    Console.WriteLine(webServer.Name + "\n")
Next webServer

Console.ReadLine()
Console.WriteLine("Press ENTER to continue")
SPGlobalAdmin globalAdmin = new SPGlobalAdmin();
SPWebServerCollection webServers = globalAdmin.Config.WebServers;

foreach (SPWebServer webServer in webServers)
{
    Console.WriteLine(webServer.Name + "\n");
}

Console.ReadLine();
Console.WriteLine("Press ENTER to continue");

See Also

Reference

SPWebServer Class

SPWebServer Members

Microsoft.SharePoint.Administration Namespace