WebRequestEvent クラス
アセンブリ: System.Web (system.web.dll 内)


WebRequestEvent は Web 要求があるたびに生成されます。
要求情報の取得には WebRequestInformation クラスを使用します。
![]() |
---|
ほとんどの場合、標準の ASP.NET 状態監視型を使用し、healthMonitoring 構成セクションを設定して動作を制御します。次の例に示すようなカスタム型を作成することもできます。カスタム イベント型を作成し、独自の情報を追加する必要がある場合は、FormatCustomEventDetails メソッドをカスタマイズします。これにより、重要なシステム情報に対する上書きや不正な変更を防げます。 |

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.Web.Management.WebBaseEvent
System.Web.Management.WebManagementEvent
System.Web.Management.WebRequestEvent


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


WebRequestEvent コンストラクタ (String, Object, Int32)
アセンブリ: System.Web (system.web.dll 内)

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


このコンストラクタをカスタマイズするコードの例を次に示します。
![]() |
---|
' 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()); }

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


WebRequestEvent コンストラクタ (String, Object, Int32, Int32)
アセンブリ: 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 )


このコンストラクタをカスタマイズするコードの例を次に示します。
![]() |
---|
' 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()); }

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


WebRequestEvent コンストラクタ

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

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 メソッド

名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 ( Object から継承されます。) |
![]() | FormatCustomEventDetails | イベント情報の標準的な形式を提供します。 ( WebBaseEvent から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 ( Object から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 ( Object から継承されます。) |
![]() | Raise | オーバーロードされます。 WebBaseEvent イベントを発生させ、構成されているプロバイダにこのイベントが発生したことを通知します。 ( WebBaseEvent から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。) |
![]() | ToString | オーバーロードされます。 イベント情報を表示用に書式設定します。 ( WebBaseEvent から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 ( Object から継承されます。) |
![]() | IncrementPerfCounters | オーバーライドされます。 パフォーマンス カウンタをインクリメントするために、内部的に使用されます。 |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 ( Object から継承されます。) |

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 アプリケーション要求に関連付けられた情報を取得します。 |

名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 (Object から継承されます。) |
![]() | FormatCustomEventDetails | イベント情報の標準的な形式を提供します。 (WebBaseEvent から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 (Object から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 (Object から継承されます。) |
![]() | Raise | オーバーロードされます。 WebBaseEvent イベントを発生させ、構成されているプロバイダにこのイベントが発生したことを通知します。 (WebBaseEvent から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。) |
![]() | ToString | オーバーロードされます。 イベント情報を表示用に書式設定します。 (WebBaseEvent から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 (Object から継承されます。) |
![]() | IncrementPerfCounters | オーバーライドされます。 パフォーマンス カウンタをインクリメントするために、内部的に使用されます。 |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 (Object から継承されます。) |

- WebRequestEventのページへのリンク