WebFailureAuditEvent クラス
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
セキュリティエラーに関する情報を提供します。
public ref class WebFailureAuditEvent : System::Web::Management::WebAuditEvent
public class WebFailureAuditEvent : System.Web.Management.WebAuditEvent
type WebFailureAuditEvent = class
inherit WebAuditEvent
Public Class WebFailureAuditEvent
Inherits WebAuditEvent
- 継承
- 派生
例
次のコード例では、 WebFailureAuditEvent クラスから派生してカスタム監査イベントを作成する方法を示します。
using System;
using System.Text;
using System.Web;
using System.Web.Management;
namespace SamplesAspNet
{
// Implements a custom WebFailureAuditEvent class.
public class SampleWebFailureAuditEvent :
System.Web.Management.WebFailureAuditEvent
{
private string customCreatedMsg, customRaisedMsg;
// Invoked in case of events identified only by their event code.
public SampleWebFailureAuditEvent(string msg, object eventSource,
int eventCode):
base(msg, eventSource, eventCode)
{
// Perform custom initialization.
customCreatedMsg =
string.Format("Event created at: {0}",
DateTime.Now.TimeOfDay.ToString());
}
// Invoked in case of events identified by their event code and
// event detailed code.
public SampleWebFailureAuditEvent(string msg, object eventSource,
int eventCode, int detailedCode):
base(msg, eventSource, eventCode, detailedCode)
{
// Perform custom initialization.
customCreatedMsg =
string.Format("Event created at: {0}",
DateTime.Now.TimeOfDay.ToString());
}
// Raises the SampleWebFailureAuditEvent.
public override void Raise()
{
// Perform custom processing.
customRaisedMsg =
string.Format("Event raised at: {0}",
DateTime.Now.TimeOfDay.ToString());
// Raise the event.
WebBaseEvent.Raise(this);
}
// Obtains the current thread information.
public WebRequestInformation GetRequestInformation()
{
// No customization is allowed.
return RequestInformation;
}
//Formats Web request event information.
//This method is invoked indirectly by the provider
//using one of the overloaded ToString methods.
public override void FormatCustomEventDetails(WebEventFormatter formatter)
{
base.FormatCustomEventDetails(formatter);
// Add custom data.
formatter.AppendLine("");
formatter.IndentationLevel += 1;
formatter.AppendLine(
"******** SampleWebFailureAuditEvent Start ********");
formatter.AppendLine(string.Format("Request path: {0}",
RequestInformation.RequestPath));
formatter.AppendLine(string.Format("Request Url: {0}",
RequestInformation.RequestUrl));
// Display custom event timing.
formatter.AppendLine(customCreatedMsg);
formatter.AppendLine(customRaisedMsg);
formatter.AppendLine(
"******** SampleWebFailureAuditEvent End ********");
formatter.IndentationLevel -= 1;
}
}
}
Imports System.Text
Imports System.Web
Imports System.Web.Management
' Implements a custom WebFailureAuditEvent class.
Public Class SampleWebFailureAuditEvent
Inherits System.Web.Management.WebFailureAuditEvent
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}", _
DateTime.Now.TimeOfDay.ToString())
End Sub
' Invoked in case of events identified by their event code and
' event detailed code.
Public Sub New(ByVal msg As String, ByVal eventSource As Object, _
ByVal eventCode As Integer, ByVal detailedCode As Integer)
MyBase.New(msg, eventSource, eventCode, detailedCode)
' Perform custom initialization.
customCreatedMsg = String.Format("Event created at: {0}", _
DateTime.Now.TimeOfDay.ToString())
End Sub
' Raises the SampleWebFailureAuditEvent.
Public Overrides Sub Raise()
' Perform custom processing.
customRaisedMsg = String.Format("Event raised at: {0}", _
DateTime.Now.TimeOfDay.ToString())
' Raise the event.
WebBaseEvent.Raise(Me)
End Sub
' Obtains the current thread information.
Public Function GetRequestInformation() As WebRequestInformation
' No customization is allowed.
Return RequestInformation
End Function 'GetRequestInformation
'Formats Web request event information.
'This method is invoked indirectly by the provider
'using one of the overloaded ToString methods.
Public Overrides Sub FormatCustomEventDetails(ByVal formatter _
As WebEventFormatter)
MyBase.FormatCustomEventDetails(formatter)
' Add custom data.
formatter.AppendLine("")
formatter.IndentationLevel += 1
formatter.AppendLine("******** SampleWebFailureAuditEvent Start ********")
formatter.AppendLine(String.Format("Request path: {0}", _
RequestInformation.RequestPath))
formatter.AppendLine(String.Format("Request Url: {0}", _
RequestInformation.RequestUrl))
' Display custom event timing.
formatter.AppendLine(customCreatedMsg)
formatter.AppendLine(customRaisedMsg)
formatter.AppendLine("******** SampleWebFailureAuditEvent End ********")
formatter.IndentationLevel -= 1
End Sub
End Class
次の構成の抜粋は、ASP.NET が WebFailureAuditEvent イベントを使用できるようにする方法を示しています。
<healthMonitoring
enabled="true"
heartBeatInterval="0">
<providers>
<add name="EventLogProvider"
type="System.Web.Management.EventLogWebEventProvider,
System.Web,Version=2.0.3600.0,Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a"/>
</providers>
<eventMappings>
<add name="SampleWebFailureAuditEvent"
type="SamplesAspNet.SampleWebFailureAuditEvent,
webfailureauditevent,Version=1.0.1663.31140,
Culture=neutral,
PublicKeyToken=0d1fa0f69d94de96,
processorArchitecture=MSIL"/>
</eventMappings>
<rules>
<add name="Custom Failure Audit Default"
eventName=" SampleWebFailureAuditEvent "
provider="EventLogProvider"
profile="Default"/>
</rules>
</healthMonitoring>
注釈
ASP.NET 正常性の監視により、運用スタッフと運用スタッフはデプロイされた Web アプリケーションを管理できます。 System.Web.Management名前空間には、アプリケーションの正常性状態データをパッケージ化する正常性イベントの種類と、このデータの処理を担当するプロバイダーの種類が含まれています。 また、正常性イベントの管理中に役立つサポート型も含まれています。
WebFailureAuditEvent クラスは、セキュリティ操作が失敗したときに使用されます。 この例として、Web 要求の URL 承認に失敗した場合があります。
既定では、ASP.NET は、次の機能に対して WebFailureAuditEvent イベントを発生するように構成されています。
ファイルの承認。 ASP.NET は、Windows ID が要求に関連付けられている場合にのみ、ファイルの承認を試みます。 関連するイベント監査コードが AuditFileAuthorizationFailure。
URL 承認。 これにより、URL リソースへの未承認のアクセス試行が制御されます。 匿名ユーザーによる失敗した試行は、ほとんどの状況で匿名認証エラーが許容されるため、監査されません。 関連するイベント監査コードが AuditUrlAuthorizationFailure。
一般的な未処理またはセキュリティの未処理の条件。 これらの条件に関連するイベント コードの一覧を次に示します。
WebFailureAuditEvent イベントが発生すると、正常性監視 ASP.NET 関連する Audit Failure Events Raised パフォーマンス カウンターがインクリメントされ、healthMonitoring 構成セクションがチェックされて、プロバイダーがイベントをサブスクライブしているかどうかを判断します。 プロバイダーがイベントをサブスクライブしている場合、ASP.NET は処理のためにイベントをディスパッチします。
Note
システム モニター (PerfMon) の Audit Failure Events Raised パフォーマンス カウンターを表示するには、 Add Counters ウィンドウで、 Performance object ドロップダウン リストから ASP.NET を選択し、Audit Failure Events Raised パフォーマンス カウンターを選択します。 をクリックし、Add ボタンをクリックします。
Note
ほとんどの場合、実装されている ASP.NET の正常性監視の種類を使用でき、healthMonitoring 構成セクションの値を指定して正常性監視システムを制御します。 正常性監視の種類から派生して、独自のカスタム イベントとプロバイダーを作成することもできます。
WebFailureAuditEvent クラスからの派生の例については、「例」セクションを参照してください。
注意 (継承者)
カスタム イベント情報を表示用に書式設定する場合は、ToString メソッドではなく、FormatCustomEventDetails(WebEventFormatter) メソッドをオーバーライドします。 これにより、機密性の高いシステム情報の上書きや改ざんを回避できます。
コンストラクター
| 名前 | 説明 |
|---|---|
| WebFailureAuditEvent(String, Object, Int32, Int32) |
指定されたパラメーターを使用して、 WebFailureAuditEvent クラスの新しいインスタンスを初期化します。 |
| WebFailureAuditEvent(String, Object, Int32) |
指定されたパラメーターを使用して、 WebFailureAuditEvent クラスの新しいインスタンスを初期化します。 |
プロパティ
| 名前 | 説明 |
|---|---|
| EventCode |
イベントに関連付けられているコード値を取得します。 (継承元 WebBaseEvent) |
| EventDetailCode |
イベントの詳細コードを取得します。 (継承元 WebBaseEvent) |
| EventID |
イベントに関連付けられている識別子を取得します。 (継承元 WebBaseEvent) |
| EventOccurrence |
イベントが発生した回数を表すカウンターを取得します。 (継承元 WebBaseEvent) |
| EventSequence |
アプリケーションによってイベントが発生した回数を取得します。 (継承元 WebBaseEvent) |
| EventSource |
イベントを発生させるオブジェクトを取得します。 (継承元 WebBaseEvent) |
| EventTime |
イベントが発生した時刻を取得します。 (継承元 WebBaseEvent) |
| EventTimeUtc |
イベントが発生した時刻を取得します。 (継承元 WebBaseEvent) |
| Message |
イベントを説明するメッセージを取得します。 (継承元 WebBaseEvent) |
| ProcessInformation |
ASP.NET アプリケーション ホスティング プロセスに関する情報を取得します。 (継承元 WebManagementEvent) |
| RequestInformation |
Web 要求に関連付けられている情報を取得します。 (継承元 WebAuditEvent) |
メソッド
| 名前 | 説明 |
|---|---|
| Equals(Object) |
指定したオブジェクトが現在のオブジェクトと等しいかどうかを判断します。 (継承元 Object) |
| FormatCustomEventDetails(WebEventFormatter) |
イベント情報の標準書式を提供します。 (継承元 WebBaseEvent) |
| GetHashCode() |
既定のハッシュ関数として機能します。 (継承元 Object) |
| GetType() |
現在のインスタンスの Type を取得します。 (継承元 Object) |
| IncrementPerfCounters() |
Audit Failure Events Raised パフォーマンス カウンターをインクリメントします。 |
| MemberwiseClone() |
現在の Objectの簡易コピーを作成します。 (継承元 Object) |
| Raise() |
イベントが発生したことを構成済みのプロバイダーに通知することによって、イベントを発生させます。 (継承元 WebBaseEvent) |
| ToString() |
表示目的でイベント情報を書式設定します。 (継承元 WebBaseEvent) |
| ToString(Boolean, Boolean) |
表示目的でイベント情報を書式設定します。 (継承元 WebBaseEvent) |