Server Property
.NET Framework Class Library
WebService..::.Server Property

Gets the HttpServerUtility for the current request.

Namespace:  System.Web.Services
Assembly:  System.Web.Services (in System.Web.Services.dll)
Visual Basic (Declaration)
<BrowsableAttribute(False)> _
Public ReadOnly Property Server As HttpServerUtility
Visual Basic (Usage)
Dim instance As WebService
Dim value As HttpServerUtility

value = instance.Server
C#
[BrowsableAttribute(false)]
public HttpServerUtility Server { get; }
Visual C++
[BrowsableAttribute(false)]
public:
property HttpServerUtility^ Server {
    HttpServerUtility^ get ();
}
JScript
public function get Server () : HttpServerUtility

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.

Visual Basic
<%@ 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

C#
<%@ 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
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
Page view tracker