WebService.Server プロパティ

定義

現在の要求に対する HttpServerUtility を取得します。

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

プロパティ値

HttpServerUtility オブジェクト。

属性

次の例では、 プロパティを使用して Web サーバーのコンピューター名を Server 返します。

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

注釈

クラスには HttpServerUtility 、(COM オブジェクトをインスタンス化するための) など CreateObject 、Web 要求の処理で使用できるいくつかのメソッドが用意されています。

適用対象

こちらもご覧ください