WebService.Server Property

Definition

Gets the HttpServerUtility for the current request.

[System.ComponentModel.Browsable(false)]
public System.Web.HttpServerUtility Server { get; }

Property Value

An HttpServerUtility object.

Attributes

Examples

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

Remarks

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

Applies to

Product Versions
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

See also