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

.NET Framework

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

.NET Framework Client Profile

Supported in: 3.5 SP1
Show:
© 2015 Microsoft