Skip to main content
.NET Framework Class Library
WebServiceServer Property

Gets the HttpServerUtility for the current request.

Namespace:   System.Web.Services
Assembly:  System.Web.Services (in System.Web.Services.dll)
Syntax
<[%$TOPIC/8takb34a_en-us_VS_110_2_0_0_0_0%](False)> _
Public ReadOnly Property Server As [%$TOPIC/8takb34a_en-us_VS_110_2_0_0_0_1%]
[[%$TOPIC/8takb34a_en-us_VS_110_2_0_1_0_0%](false)]
public [%$TOPIC/8takb34a_en-us_VS_110_2_0_1_0_1%] Server { get; }
[[%$TOPIC/8takb34a_en-us_VS_110_2_0_2_0_0%](false)]
public:
property [%$TOPIC/8takb34a_en-us_VS_110_2_0_2_0_1%]^ Server {
	[%$TOPIC/8takb34a_en-us_VS_110_2_0_2_0_2%]^ get ();
}
[<[%$TOPIC/8takb34a_en-us_VS_110_2_0_3_0_0%](false)>]
member Server : [%$TOPIC/8takb34a_en-us_VS_110_2_0_3_0_1%] with get
Remarks

The HttpServerUtility class provides several methods that can be used in the processing of Web requests, including CreateObject (for instantiating COM objects).

Examples

The example below returns the computer name of the Web server using the Server property.

<%@ WebService Language="VB" Class="Util" %> 

Imports System.Web.Services

Public Class Util
    Inherits WebService

    <WebMethod(Description := "Obtains the Computer Machine Name", _
        EnableSession := False)> _
    Public Function GetMachineName() As String

        Return Server.MachineName
    End Function
End Class
    
<%@ WebService Language="C#" Class="Util" %>

 using System.Web.Services;

 public class Util: WebService {
    [ WebMethod(Description="Obtains the Server Computer Name",EnableSession=false)]
    public string GetMachineName() {
       return Server.MachineName;
    }
 }
    
Version Information

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 3.5 SP1
Platforms

Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.