WebService.Server Property
Gets the HttpServerUtility for the current request.
[Visual Basic] Public ReadOnly Property Server As HttpServerUtility [C#] public HttpServerUtility Server {get;} [C++] public: __property HttpServerUtility* get_Server(); [JScript] public function get Server() : HttpServerUtility;
Property Value
An HttpServerUtility object.
Remarks
The HttpServerUtility class provides several methods that can be used in the processing of Web requests, including CreateObject (for instantiating COM objects).
Example
[Visual Basic, C#] 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; } }
[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
See Also
WebService Class | WebService Members | System.Web.Services Namespace | HttpServerUtility | CreateObject