WebRequestEventとは? わかりやすく解説

WebRequestEvent クラス

メモ : このクラスは、.NET Framework version 2.0 で新しく追加されたものです。

Web 要求情報を提供するイベントの基本クラスを定義します。

名前空間: System.Web.Management
アセンブリ: System.Web (system.web.dll 内)
構文構文

Public Class WebRequestEvent
    Inherits WebManagementEvent
Dim instance As WebRequestEvent
public class WebRequestEvent : WebManagementEvent
public ref class WebRequestEvent : public
 WebManagementEvent
public class WebRequestEvent extends WebManagementEvent
public class WebRequestEvent extends
 WebManagementEvent
解説解説
使用例使用例

WebRequestEvent クラスの派生としてカスタム イベントを作成する方法を次のコード例に示します。

Imports System
Imports System.Text
Imports System.Web
Imports System.Web.Management
Imports System.Web.UI
Imports System.Web.UI.WebControls


' Implements a custom WebRequestEvent. 
Public Class SampleWebRequestEvent
    Inherits System.Web.Management.WebRequestEvent
    Private customCreatedMsg, customRaisedMsg As
 String
    
    
    ' Invoked in case of events identified only 
    ' by their event code.
    Public Sub New(ByVal
 msg As String, _
    ByVal eventSource As Object,
 _
    ByVal eventCode As Integer)
        MyBase.New(msg, eventSource, eventCode)

        ' Perform custom initialization.
        customCreatedMsg = String.Format( _
        "Event created at: {0}", _
        EventTime.ToString())

    End Sub 'New
    
    
    ' Invoked in case of events identified 
    ' by their event code.and 
    ' related event detailed code.
    Public Sub New(ByVal
 msg As String, _
    ByVal eventSource As Object,
 _
    ByVal eventCode As Integer,
 _
    ByVal eventDetailCode As Integer)
        MyBase.New(msg, eventSource, _
        eventCode, eventDetailCode)
        ' Perform custom initialization.
        customCreatedMsg = String.Format( _
        "Event created at: {0}", _
        EventTime.ToString())

    End Sub 'New
    

    ' Raises the SampleWebRequestEvent.
    Public Overrides Sub
 Raise() 
        ' Perform custom processing.
        customRaisedMsg = String.Format( _
        "Event raised at: {0}", _
        EventTime.ToString())
        
        ' Raise the event.
        MyBase.Raise()
    
    End Sub 'Raise
    
    
    'Formats Web request event information.
    Public Overrides Sub
 FormatCustomEventDetails( _
    ByVal formatter As WebEventFormatter)
        ' Add custom data.
        formatter.AppendLine("")

        formatter.IndentationLevel += 1
        formatter.AppendLine( _
        "* Custom Request Information Start *")

        '// Display custom event timing.
        formatter.AppendLine(customCreatedMsg)
        formatter.AppendLine(customRaisedMsg)

        formatter.AppendLine( _
        "* Custom Request Information End *")

        formatter.IndentationLevel -= 1

    End Sub 'FormatCustomEventDetails
 
End Class 'SampleWebRequestEvent

using System;
using System.Text;
using System.Web;
using System.Web.Management;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace SamplesAspNet
{
    // Implements a custom WebRequestEvent. 
    public class SampleWebRequestEvent :
      System.Web.Management.WebRequestEvent
    {
        private string  customCreatedMsg, 
                        customRaisedMsg;

        // Invoked in case of events identified only 
        // by their event code.
        public SampleWebRequestEvent(
            string msg, 
            object eventSource, int eventCode): 
            base(msg, eventSource, eventCode)
        {
           
            // Perform custom initialization.
            customCreatedMsg =
              string.Format(
              "Event created at: {0}", 
              EventTime.ToString());
        }


        // Invoked in case of events identified 
        // by their event code.and 
        // related event detailed code.
        public SampleWebRequestEvent(string
 msg,
            object eventSource, int eventCode,
            int eventDetailCode):
            base(msg, eventSource, eventCode, 
            eventDetailCode)
        {
            // Perform custom initialization.
            customCreatedMsg =
              string.Format(
              "Event created at: {0}", 
              EventTime.ToString());

        }


        // Raises the SampleWebRequestEvent.
        public override void Raise()
        {
            // Perform custom processing.
            customRaisedMsg =
              string.Format(
              "Event raised at: {0}", 
              EventTime.ToString());

            // Raise the event.
            base.Raise();
        }


        //Formats Web request event information.
        public override void FormatCustomEventDetails(
            WebEventFormatter formatter)
        {
            // Add custom data.
            formatter.AppendLine("");

            formatter.IndentationLevel += 1;
            formatter.AppendLine(
                "* Custom Request Information Start *");

            //// Display custom event timing.
            formatter.AppendLine(customCreatedMsg);
            formatter.AppendLine(customRaisedMsg);

            formatter.AppendLine(
                "* Custom Request Information End *");

            formatter.IndentationLevel -= 1;

        }

    }
}

次に示すのは、ASP.NET でカスタム イベントを使用できるようにする構成ファイルの抜粋です。

<healthMonitoring 
  enabled="true" heartBeatInterval="0">

  <providers>
    <!-- Define the custom provider that 
         processes custom Web request events. -->
    <add name="SampleWebEventProvider" 
type="SamplesAspNet.SampleEventProvider,webeventprovider,Version=1.0.1573.18094,
 Culture=neutral, PublicKeyToken=b5a57a9a9d487cf4, processorArchitecture=MSIL"/>

  </providers>

  <eventMappings>

    <!--  Define the event source that 
         issues custom events.   -->
    <add  name="SampleWebRequestEvent" 
type="SamplesAspNet.SampleWebRequestEvent,webrequestevent,Version=1.0.1573.23947,
 Culture=neutral, PublicKeyToken=e717d983a78c8ddb, processorArchitecture=MSIL"/>
  
  </eventMappings>
  
  <rules>
    
    <!-- Associate custom event with 
        related custom provider -->
    <add 
      name="CustomWebRequestEvent"
      eventName="SampleWebRequestEvent" 
      provider="SampleWebEventProvider" 
      profile="Critical"/>

  </rules>

</healthMonitoring>
継承階層継承階層
System.Object
   System.Web.Management.WebBaseEvent
     System.Web.Management.WebManagementEvent
      System.Web.Management.WebRequestEvent
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
WebRequestEvent メンバ
System.Web.Management 名前空間
その他の技術情報
healthMonitoring 要素 (ASP.NET 設定スキーマ)
ASP.NET の状態監視

WebRequestEvent コンストラクタ (String, Object, Int32)

メモ : このコンストラクタは、.NET Framework version 2.0 で新しく追加されたものです。

イベント パラメータを指定して WebRequestEvent クラスを初期化します。

名前空間: System.Web.Management
アセンブリ: System.Web (system.web.dll 内)
構文構文

Protected Friend Sub New
 ( _
    message As String, _
    eventSource As Object, _
    eventCode As Integer _
)
Dim message As String
Dim eventSource As Object
Dim eventCode As Integer

Dim instance As New WebRequestEvent(message,
 eventSource, eventCode)
protected internal WebRequestEvent (
    string message,
    Object eventSource,
    int eventCode
)
protected public:
WebRequestEvent (
    String^ message, 
    Object^ eventSource, 
    int eventCode
)
protected WebRequestEvent (
    String message, 
    Object eventSource, 
    int eventCode
)
protected internal function
 WebRequestEvent (
    message : String, 
    eventSource : Object, 
    eventCode : int
)

パラメータ

message

イベントに関連付けられているメッセージ。

eventSource

イベントのソースであるオブジェクト。

eventCode

イベントに関連付けられている WebEventCodes コード。これは WebExtendedBase よりも大きくする必要があります。

解説解説
使用例使用例

このコンストラクタをカスタマイズするコードの例を次に示します。

メモメモ

イベントのコードまたは識別子の定義に使用する値は、WebExtendedBase より大きくする必要があります。

' Invoked in case of events identified only 
' by their event code.
Public Sub New(ByVal
 msg As String, _
ByVal eventSource As Object,
 _
ByVal eventCode As Integer)
    MyBase.New(msg, eventSource, eventCode)

    ' Perform custom initialization.
    customCreatedMsg = String.Format( _
    "Event created at: {0}", _
    EventTime.ToString())

End Sub 'New

// Invoked in case of events identified only 
// by their event code.
public SampleWebRequestEvent(
    string msg, 
    object eventSource, int eventCode): 
    base(msg, eventSource, eventCode)
{
   
    // Perform custom initialization.
    customCreatedMsg =
      string.Format(
      "Event created at: {0}", 
      EventTime.ToString());
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
WebRequestEvent クラス
WebRequestEvent メンバ
System.Web.Management 名前空間

WebRequestEvent コンストラクタ (String, Object, Int32, Int32)

メモ : このコンストラクタは、.NET Framework version 2.0 で新しく追加されたものです。

イベント パラメータを指定して WebRequestEvent クラスを初期化します。

名前空間: System.Web.Management
アセンブリ: System.Web (system.web.dll 内)
構文構文

Protected Friend Sub New
 ( _
    message As String, _
    eventSource As Object, _
    eventCode As Integer, _
    eventDetailCode As Integer _
)
Dim message As String
Dim eventSource As Object
Dim eventCode As Integer
Dim eventDetailCode As Integer

Dim instance As New WebRequestEvent(message,
 eventSource, eventCode, eventDetailCode)
protected internal WebRequestEvent (
    string message,
    Object eventSource,
    int eventCode,
    int eventDetailCode
)
protected public:
WebRequestEvent (
    String^ message, 
    Object^ eventSource, 
    int eventCode, 
    int eventDetailCode
)
protected WebRequestEvent (
    String message, 
    Object eventSource, 
    int eventCode, 
    int eventDetailCode
)
protected internal function
 WebRequestEvent (
    message : String, 
    eventSource : Object, 
    eventCode : int, 
    eventDetailCode : int
)

パラメータ

message

イベントに関連付けられているメッセージ。

eventSource

イベントのソースであるオブジェクト。

eventCode

イベントに関連付けられている WebEventCodes コード。これは WebExtendedBase よりも大きくする必要があります。

eventDetailCode

イベントに関連付けられている WebEventCodes 詳細コード。

解説解説
使用例使用例

このコンストラクタをカスタマイズするコードの例を次に示します。

メモメモ

イベントのコードまたは識別子の定義に使用する値は、WebExtendedBase より大きくする必要があります。

' Invoked in case of events identified 
' by their event code.and 
' related event detailed code.
Public Sub New(ByVal
 msg As String, _
ByVal eventSource As Object,
 _
ByVal eventCode As Integer,
 _
ByVal eventDetailCode As Integer)
    MyBase.New(msg, eventSource, _
    eventCode, eventDetailCode)
    ' Perform custom initialization.
    customCreatedMsg = String.Format( _
    "Event created at: {0}", _
    EventTime.ToString())

End Sub 'New

// Invoked in case of events identified 
// by their event code.and 
// related event detailed code.
public SampleWebRequestEvent(string msg,
    object eventSource, int eventCode,
    int eventDetailCode):
    base(msg, eventSource, eventCode, 
    eventDetailCode)
{
    // Perform custom initialization.
    customCreatedMsg =
      string.Format(
      "Event created at: {0}", 
      EventTime.ToString());

}

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
WebRequestEvent クラス
WebRequestEvent メンバ
System.Web.Management 名前空間

WebRequestEvent コンストラクタ

WebRequestEvent クラスの新しいインスタンスを初期化します。
オーバーロードの一覧オーバーロードの一覧

名前 説明
WebRequestEvent (String, Object, Int32) イベント パラメータを指定して WebRequestEvent クラスを初期化します。
WebRequestEvent (String, Object, Int32, Int32) イベント パラメータを指定して WebRequestEvent クラスを初期化します。
参照参照

関連項目

WebRequestEvent クラス
WebRequestEvent メンバ
System.Web.Management 名前空間

WebRequestEvent プロパティ


パブリック プロパティパブリック プロパティ

  名前 説明
パブリック プロパティ ApplicationInformation  監視中の現在のアプリケーションに関する情報を格納している WebApplicationInformation オブジェクトを取得します。 ( WebBaseEvent から継承されます。)
パブリック プロパティ EventCode  イベントに関連付けられているコード値を取得します。 ( WebBaseEvent から継承されます。)
パブリック プロパティ EventDetailCode  イベント詳細コードを取得します。 ( WebBaseEvent から継承されます。)
パブリック プロパティ EventID  イベントに関連付けられている識別子を取得します。 ( WebBaseEvent から継承されます。)
パブリック プロパティ EventOccurrence  イベントが発生した回数を表すカウンタを取得します。 ( WebBaseEvent から継承されます。)
パブリック プロパティ EventSequence  アプリケーションによるイベントの発生回数を取得します。 ( WebBaseEvent から継承されます。)
パブリック プロパティ EventSource  イベントを発生させるオブジェクトを取得します。 ( WebBaseEvent から継承されます。)
パブリック プロパティ EventTime  イベントが発生した時刻を取得します。 ( WebBaseEvent から継承されます。)
パブリック プロパティ EventTimeUtc  イベントが発生した時刻を取得します。 ( WebBaseEvent から継承されます。)
パブリック プロパティ Message  イベントを説明するメッセージを取得します。 ( WebBaseEvent から継承されます。)
パブリック プロパティ ProcessInformation  ASP.NET アプリケーション ホスト プロセスに関する情報を取得します。 ( WebManagementEvent から継承されます。)
パブリック プロパティ RequestInformation Web アプリケーション要求に関連付けられた情報を取得します。
参照参照

関連項目

WebRequestEvent クラス
System.Web.Management 名前空間

その他の技術情報

healthMonitoring 要素 (ASP.NET 設定スキーマ)
ASP.NET の状態監視

WebRequestEvent メソッド


パブリック メソッドパブリック メソッド

プロテクト メソッドプロテクト メソッド
参照参照

関連項目

WebRequestEvent クラス
System.Web.Management 名前空間

その他の技術情報

healthMonitoring 要素 (ASP.NET 設定スキーマ)
ASP.NET の状態監視

WebRequestEvent メンバ

Web 要求情報を提供するイベントの基本クラスを定義します。

WebRequestEvent データ型で公開されるメンバを以下の表に示します。


プロテクト コンストラクタプロテクト コンストラクタ
パブリック プロパティパブリック プロパティ
  名前 説明
パブリック プロパティ ApplicationInformation  監視中の現在のアプリケーションに関する情報を格納している WebApplicationInformation オブジェクトを取得します。(WebBaseEvent から継承されます。)
パブリック プロパティ EventCode  イベントに関連付けられているコード値を取得します。(WebBaseEvent から継承されます。)
パブリック プロパティ EventDetailCode  イベント詳細コードを取得します。(WebBaseEvent から継承されます。)
パブリック プロパティ EventID  イベントに関連付けられている識別子を取得します。(WebBaseEvent から継承されます。)
パブリック プロパティ EventOccurrence  イベントが発生した回数を表すカウンタを取得します。(WebBaseEvent から継承されます。)
パブリック プロパティ EventSequence  アプリケーションによるイベントの発生回数を取得します。(WebBaseEvent から継承されます。)
パブリック プロパティ EventSource  イベントを発生させるオブジェクトを取得します。(WebBaseEvent から継承されます。)
パブリック プロパティ EventTime  イベントが発生した時刻を取得します。(WebBaseEvent から継承されます。)
パブリック プロパティ EventTimeUtc  イベントが発生した時刻を取得します。(WebBaseEvent から継承されます。)
パブリック プロパティ Message  イベントを説明するメッセージを取得します。(WebBaseEvent から継承されます。)
パブリック プロパティ ProcessInformation  ASP.NET アプリケーション ホスト プロセスに関する情報を取得します。(WebManagementEvent から継承されます。)
パブリック プロパティ RequestInformation Web アプリケーション要求に関連付けられた情報を取得します。
パブリック メソッドパブリック メソッド
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

WebRequestEvent クラス
System.Web.Management 名前空間

その他の技術情報

healthMonitoring 要素 (ASP.NET 設定スキーマ)
ASP.NET の状態監視



英和和英テキスト翻訳

英語⇒日本語日本語⇒英語

辞書ショートカット

すべての辞書の索引

「WebRequestEvent」の関連用語

WebRequestEventのお隣キーワード

   

英語⇒日本語
日本語⇒英語
   



WebRequestEventのページの著作権

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2026 Microsoft.All rights reserved.

©2026 GRAS Group, Inc.RSS