WebService.Server Własność
Definicja
Ważny
Niektóre informacje dotyczą produktów przedpremierowych, które mogą zostać znacznie zmodyfikowane przed premierą. Microsoft nie udziela żadnych gwarancji, ani wyraźnych, ani domniemanych, dotyczących informacji podanych tutaj.
Pobiera element HttpServerUtility dla bieżącego żądania.
public:
property System::Web::HttpServerUtility ^ Server { System::Web::HttpServerUtility ^ get(); };
[System.ComponentModel.Browsable(false)]
public System.Web.HttpServerUtility Server { get; }
[<System.ComponentModel.Browsable(false)>]
member this.Server : System.Web.HttpServerUtility
Public ReadOnly Property Server As HttpServerUtility
Wartość nieruchomości
Obiekt HttpServerUtility.
- Atrybuty
Przykłady
Poniższy przykład zwraca nazwę komputera serwera sieci Web przy użyciu Server właściwości .
<%@ 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;
}
}
<%@ 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
Uwagi
Klasa HttpServerUtility udostępnia kilka metod, które mogą być używane do przetwarzania żądań sieci Web, w tym CreateObject (na potrzeby tworzenia wystąpień obiektów COM).