WebAuthenticationFailureAuditEvent Classe

Definizione

Fornisce informazioni sugli errori di autenticazione 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
Ereditarietà

Esempio

Nell'esempio di codice seguente viene illustrato come usare la WebAuthenticationFailureAuditEvent classe .


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

Commenti

Nell'elenco seguente vengono descritte le funzionalità per le quali gli eventi WebAuthenticationFailureAuditEvent vengono generati per impostazione predefinita da ASP.NET.

Note

Per impostazione predefinita, ASP.NET è configurato solo per registrare le condizioni di errore di controllo, perché la registrazione delle condizioni di esito positivo può compromettere notevolmente le risorse di sistema. È sempre possibile configurare il sistema per registrare le condizioni di esito positivo.

  • Autenticazione basata su form. Mentre i controlli di esito positivo includono il nome utente autenticato; I controlli di errore non includono il nome utente, perché in genere derivano da un ticket che non ha superato la decrittografia o la convalida. Entrambi contengono l'indirizzo IP del client. Il codice di controllo eventi correlato è AuditFormsAuthenticationFailure.

  • Iscrizione. I controlli di esito positivo e negativo contengono il nome utente che è stato tentato. Nessuna forma di controllo conterrà la password che è stata tentata, perché rischierebbe di rendere persistente una password valida nel log. Il codice di controllo eventi correlato è AuditMembershipAuthenticationFailure.

Quando un WebAuthenticationFailureAuditEvent oggetto viene generato, per impostazione predefinita aggiorna il contatore delle prestazioni Audit Authentication Failure Events Raised . Per visualizzare questo contatore delle prestazioni in Monitoraggio di sistema (PerfMon), nella finestra Aggiungi contatori selezionare ASP.NET nell'elenco a discesa Performanceoggetto, selezionare il contatore delle prestazioni Eventi di errore di autenticazione generati e fare clic sul pulsante Aggiungi. Per altre informazioni, vedere Using the System Monitor (PerfMon) with ASP.NET Applications.

Note

Nella maggior parte dei casi sarà possibile usare i tipi di monitoraggio dell'integrità ASP.NET implementati e sarà possibile controllare il sistema di monitoraggio dell'integrità specificando i valori nella sezione di configurazione healthMonitoring. È anche possibile derivare dai tipi di monitoraggio dell'integrità per creare provider ed eventi personalizzati. Per un esempio di derivazione dalla WebAuthenticationFailureAuditEvent classe , vedere l'esempio fornito in questo argomento.

Costruttori

Nome Descrizione
WebAuthenticationFailureAuditEvent(String, Object, Int32, Int32, String)

Inizializza una nuova istanza della WebAuthenticationFailureAuditEvent classe con i parametri di evento specificati.

WebAuthenticationFailureAuditEvent(String, Object, Int32, String)

Inizializza una nuova istanza della WebAuthenticationFailureAuditEvent classe con i parametri di evento specificati.

Proprietà

Nome Descrizione
EventCode

Ottiene il valore di codice associato all'evento.

(Ereditato da WebBaseEvent)
EventDetailCode

Ottiene il codice di dettaglio dell'evento.

(Ereditato da WebBaseEvent)
EventID

Ottiene l'identificatore associato all'evento.

(Ereditato da WebBaseEvent)
EventOccurrence

Ottiene un contatore che rappresenta il numero di volte in cui si è verificato l'evento.

(Ereditato da WebBaseEvent)
EventSequence

Ottiene il numero di volte in cui l'evento è stato generato dall'applicazione.

(Ereditato da WebBaseEvent)
EventSource

Ottiene l'oggetto che genera l'evento.

(Ereditato da WebBaseEvent)
EventTime

Ottiene l'ora in cui è stato generato l'evento.

(Ereditato da WebBaseEvent)
EventTimeUtc

Ottiene l'ora in cui è stato generato l'evento.

(Ereditato da WebBaseEvent)
Message

Ottiene il messaggio che descrive l'evento.

(Ereditato da WebBaseEvent)
NameToAuthenticate

Ottiene il nome dell'utente da autenticare.

ProcessInformation

Ottiene informazioni sul processo di hosting dell'applicazione ASP.NET.

(Ereditato da WebManagementEvent)
RequestInformation

Ottenere le informazioni associate alla richiesta Web.

(Ereditato da WebAuditEvent)

Metodi

Nome Descrizione
Equals(Object)

Determina se l'oggetto specificato è uguale all'oggetto corrente.

(Ereditato da Object)
FormatCustomEventDetails(WebEventFormatter)

Fornisce la formattazione standard delle informazioni sull'evento.

(Ereditato da WebBaseEvent)
GetHashCode()

Funge da funzione hash predefinita.

(Ereditato da Object)
GetType()

Ottiene il Type dell'istanza corrente.

(Ereditato da Object)
IncrementPerfCounters()

Incrementa il contatore delle prestazioni Generato dagli eventi di errore di controllo.

(Ereditato da WebFailureAuditEvent)
MemberwiseClone()

Crea una copia superficiale del Objectcorrente.

(Ereditato da Object)
Raise()

Genera un evento notificando a qualsiasi provider configurato che si è verificato l'evento.

(Ereditato da WebBaseEvent)
ToString()

Formatta le informazioni sugli eventi a scopo di visualizzazione.

(Ereditato da WebBaseEvent)
ToString(Boolean, Boolean)

Formatta le informazioni sugli eventi a scopo di visualizzazione.

(Ereditato da WebBaseEvent)

Si applica a

Vedi anche