次の方法で共有


WebAuthenticationFailureAuditEvent クラス

定義

ASP.NET 認証エラーに関する情報を提供します。

public ref class WebAuthenticationFailureAuditEvent : System::Web::Management::WebFailureAuditEvent
public class WebAuthenticationFailureAuditEvent : System.Web.Management.WebFailureAuditEvent
type WebAuthenticationFailureAuditEvent = class
    inherit WebFailureAuditEvent
Public Class WebAuthenticationFailureAuditEvent
Inherits WebFailureAuditEvent
継承

WebAuthenticationFailureAuditEvent クラスを使用するコード例を次に示します。


using System;
using System.Text;
using System.Web;
using System.Web.Management;

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

        // Invoked in case of events identified only by 
        // their event code.
        public SampleWebAuthenticationFailureAuditEvent(
            string msg, object eventSource, 
            int eventCode, string userName):
        base(msg, eventSource, eventCode, userName)
        {
            // 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 SampleWebAuthenticationFailureAuditEvent(
            string msg, object eventSource,
            int eventCode, int detailedCode, string userName):
        base(msg, eventSource, eventCode, detailedCode, userName)
        {
            // Perform custom initialization.
            customCreatedMsg =
            string.Format("Event created at: {0}",
                DateTime.Now.TimeOfDay.ToString());
        }


        // Raises the SampleWebAuthenticationFailureAuditEvent.
        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(
                "* SampleWebAuthenticationFailureAuditEvent 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(
                "* SampleWebAuthenticationFailureAuditEvent End *");

            formatter.IndentationLevel -= 1;
        }
    }
}
Imports System.Text
Imports System.Web
Imports System.Web.Management


' Implements a custom WebAuthenticationFailureAuditEvent class. 

Public Class SampleWebAuthenticationFailureAuditEvent
    Inherits System.Web.Management.WebAuthenticationFailureAuditEvent
    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, _
    ByVal userName As String)
        MyBase.New(msg, eventSource, eventCode, userName)
        ' 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, _
    ByVal userName As String)
        MyBase.New(msg, eventSource, eventCode, _
        detailedCode, userName)
        ' Perform custom initialization.
        customCreatedMsg = _
        String.Format( _
        "Event created at: {0}", DateTime.Now.TimeOfDay.ToString())

    End Sub



    ' Raises the SampleWebAuthenticationFailureAuditEvent.
    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( _
        "* SampleWebAuthenticationFailureAuditEvent 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( _
        "* SampleWebAuthenticationFailureAuditEvent End *")

        formatter.IndentationLevel -= 1

    End Sub
End Class

注釈

次の一覧では、ASP.NET によってイベントが既定で発生する WebAuthenticationFailureAuditEvent 機能について説明します。

Note

既定では、ASP.NET は監査エラーの状態のみをログに記録するように構成されています。ログの成功条件によってシステム リソースが著しく負担される可能性があるためです。 成功条件をログに記録するようにシステムを常に構成できます。

  • フォーム認証。 成功監査には認証されたユーザー名が含まれます。失敗監査には、通常、暗号化解除または検証に失敗したチケットが原因であるため、ユーザー名は含まれません。 両方にクライアント IP アドレスが含まれています。 関連するイベント監査コードは です AuditFormsAuthenticationFailure

  • メンバーシップ。 成功と失敗の両方の監査には、試行されたユーザー名が含まれています。 どちらの形式の監査にも、ログに有効なパスワードを保持するリスクがあるため、試行されたパスワードは含まれていません。 関連するイベント監査コードは です AuditMembershipAuthenticationFailure

WebAuthenticationFailureAuditEventが発生すると、既定では、Audit Authentication Failure Events Raised パフォーマンス カウンターが更新されます。 システム モニター (PerfMon) でこのパフォーマンス カウンターを表示するには、[パフォーマンス オブジェクト] ドロップダウン リストの [カウンターの追加] ウィンドウで、[ASP.NET認証エラー イベントが発生しました] パフォーマンス カウンターを選択し、[追加] ボタンをクリックします。 詳細については、「 ASP.NET アプリケーションでのシステム モニター (PerfMon) の使用」を参照してください。

Note

ほとんどの場合、実装されている ASP.NET の正常性監視の種類を使用でき、構成セクションで値を指定して正常性監視システムを healthMonitoring 制御します。 正常性監視の種類から派生して、独自のカスタム イベントとプロバイダーを作成することもできます。 クラスからの WebAuthenticationFailureAuditEvent 派生の例については、このトピックで提供されている例を参照してください。

コンストラクター

WebAuthenticationFailureAuditEvent(String, Object, Int32, Int32, String)

指定したイベント パラメーターを使用して、WebAuthenticationFailureAuditEvent クラスの新しいインスタンスを初期化します。

WebAuthenticationFailureAuditEvent(String, Object, Int32, String)

指定したイベント パラメーターを使用して、WebAuthenticationFailureAuditEvent クラスの新しいインスタンスを初期化します。

プロパティ

EventCode

イベントに関連付けられているコード値を取得します。

(継承元 WebBaseEvent)
EventDetailCode

イベント詳細コードを取得します。

(継承元 WebBaseEvent)
EventID

イベントに関連付けられた識別子を取得します。

(継承元 WebBaseEvent)
EventOccurrence

イベントが発生した回数を表すカウンターを取得します。

(継承元 WebBaseEvent)
EventSequence

アプリケーションによるイベントの発生回数を取得します。

(継承元 WebBaseEvent)
EventSource

イベントを発生させるオブジェクトを取得します。

(継承元 WebBaseEvent)
EventTime

イベントが発生した時刻を取得します。

(継承元 WebBaseEvent)
EventTimeUtc

イベントが発生した時刻を取得します。

(継承元 WebBaseEvent)
Message

イベントを説明するメッセージを取得します。

(継承元 WebBaseEvent)
NameToAuthenticate

認証対象のユーザー名を取得します。

ProcessInformation

ASP.NET アプリケーション ホスト プロセスに関する情報を取得します。

(継承元 WebManagementEvent)
RequestInformation

Web 要求に関連付けられた情報を取得します。

(継承元 WebAuditEvent)

メソッド

Equals(Object)

指定されたオブジェクトが現在のオブジェクトと等しいかどうかを判断します。

(継承元 Object)
FormatCustomEventDetails(WebEventFormatter)

イベント情報の標準的な形式を提供します。

(継承元 WebBaseEvent)
GetHashCode()

既定のハッシュ関数として機能します。

(継承元 Object)
GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
IncrementPerfCounters()

Audit Failure Events Raised パフォーマンス カウンターをインクリメントします。

(継承元 WebFailureAuditEvent)
MemberwiseClone()

現在の Object の簡易コピーを作成します。

(継承元 Object)
Raise()

イベントを発生させ、構成されているプロバイダーにそのイベントが発生したことを通知します。

(継承元 WebBaseEvent)
ToString()

イベント情報を表示用に書式設定します。

(継承元 WebBaseEvent)
ToString(Boolean, Boolean)

イベント情報を表示用に書式設定します。

(継承元 WebBaseEvent)

適用対象

こちらもご覧ください