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


次の一覧に、ASP.NET によって既定で生成される WebAuthenticationFailureAuditEvent イベントの機能を示します。
![]() |
---|
既定で、ASP.NET は監査エラーだけをログに記録するよう構成されます。これは、正常終了をログに記録するとシステム リソースが大量に消費されるためです。いつでも、正常終了をログに記録するように設定できます。 |
-
フォームの認証。監査が正常終了すると認証されたユーザー名が記録されますが、監査がエラーになった場合、復号または検査でエラーになったチケットが原因であることが多く、ユーザー名は記録されません。どちらの場合もクライアントの IP アドレスは記録されます。関連するイベント監査コードは AuditFormsAuthenticationFailure です。
-
メンバシップ。監査が正常終了した場合もエラーになった場合も、試行したユーザー名が記録されます。どちらの監査フォームにも試行されたパスワードは記録されません。これは、有効なパスワードがログに残らないようにするためです。関連するイベント監査コードは AuditMembershipAuthenticationFailure です。
WebAuthenticationFailureAuditEvent が発生すると、既定で Audit Authentication Failure Events Raised パフォーマンス カウンタが更新されます。このパフォーマンス カウンタをシステム モニタ (PerfMon) に表示するには、[カウンタの追加] ウィンドウで [パフォーマンス オブジェクト] ドロップダウンリストの [ASP.NET] をクリックし、[Authentication Failure Events Raised] パフォーマンス カウンタを選択して、[追加] ボタンをクリックします。詳細については、MSDN の「Using the System Monitor (PerfMon) with ASP.NET Applications」を参照してください。

WebAuthenticationFailureAuditEvent クラスを使用するコード例を次に示します。
Imports System 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 'New ' 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 'New ' 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 'Raise ' 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 'FormatCustomEventDetails End Class 'SampleWebAuthenticationFailureAuditEvent
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; } } }

System.Web.Management.WebBaseEvent
System.Web.Management.WebManagementEvent
System.Web.Management.WebAuditEvent
System.Web.Management.WebFailureAuditEvent
System.Web.Management.WebAuthenticationFailureAuditEvent


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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- WebAuthenticationFailureAuditEvent クラスのページへのリンク