Export (0) Print
Expand All

WebService.Server Property

Gets the HttpServerUtility for the current request.

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

[BrowsableAttribute(false)]
public HttpServerUtility Server { get; }

Property Value

Type: System.Web.HttpServerUtility
An HttpServerUtility object.

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

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

<%@ 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;
    }
 }

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

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

.NET Framework

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

Community Additions

ADD
Show:
© 2014 Microsoft