WebService.Server Propriété

Définition

Obtient le HttpServerUtility pour la demande en cours.

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

Valeur de propriété

Objet HttpServerUtility.

Attributs

Exemples

L’exemple ci-dessous retourne le nom de l’ordinateur du serveur Web à l’aide de la Server propriété .

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

Remarques

La HttpServerUtility classe fournit plusieurs méthodes qui peuvent être utilisées dans le traitement des requêtes Web, notamment CreateObject (pour instancier des objets COM).

S’applique à

Voir aussi