PasswordRecovery.OnVerifyingAnswer(LoginCancelEventArgs) Metodo

Definizione

Genera l'evento VerifyingAnswer.

protected:
 virtual void OnVerifyingAnswer(System::Web::UI::WebControls::LoginCancelEventArgs ^ e);
protected virtual void OnVerifyingAnswer(System.Web.UI.WebControls.LoginCancelEventArgs e);
abstract member OnVerifyingAnswer : System.Web.UI.WebControls.LoginCancelEventArgs -> unit
override this.OnVerifyingAnswer : System.Web.UI.WebControls.LoginCancelEventArgs -> unit
Protected Overridable Sub OnVerifyingAnswer (e As LoginCancelEventArgs)

Parametri

e
LoginCancelEventArgs

Oggetto CancelEventArgs contenente i dati dell'evento.

Esempio

Nell'esempio di codice seguente viene creato un controllo personalizzato PasswordRecovery che implementa il OnVerifyingAnswer metodo . La classe personalizzata chiama semplicemente l'implementazione di base del OnVerifyingAnswer metodo .

<%@ page language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">

    class CustomPasswordRecovery : PasswordRecovery
    {
        override protected void OnVerifyingAnswer(System.Web.UI.WebControls.LoginCancelEventArgs e)
        {
            base.OnVerifyingAnswer(e);
        }
    }
    
    // Add the custom password recovery control to the page.
    void Page_Init(object sender, EventArgs e)
    {
        CustomPasswordRecovery passwordRecoveryControl = new CustomPasswordRecovery();
        passwordRecoveryControl.ID = "passwordRecoveryControl";
        PlaceHolder1.Controls.Add(passwordRecoveryControl);
    
    }
    
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
  <head runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
    <form id="form1" runat="server">
      <p>
        <asp:placeholder id="PlaceHolder1" 
          runat="server">
        </asp:placeholder>
        &nbsp;
      </p>
    </form>
  </body>
</html>
<%@ page language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">

    Class CustomPasswordRecovery
    
        Inherits PasswordRecovery
        
        Overloads Sub OnVerifyingAnswer(ByVal e As System.Web.UI.WebControls.LoginCancelEventArgs)
            MyBase.OnVerifyingAnswer(e)
        End Sub
        
    End Class

    ' Add the custom password recovery control to the page.
    Sub Page_Init(ByVal sender As Object, ByVal e As EventArgs)
    
        Dim passwordRecoveryControl As New CustomPasswordRecovery
        passwordRecoveryControl.ID = "passwordRecoveryControl"
        PlaceHolder1.Controls.Add(passwordRecoveryControl)
        
    End Sub
    
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
  <head runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
    <form id="form1" runat="server">
      <p>
        <asp:placeholder id="PlaceHolder1" 
          runat="server">
        </asp:placeholder>
        &nbsp;
      </p>
    </form>
  </body>
</html>

Commenti

Il OnVerifyingAnswer metodo viene chiamato prima che la risposta dell'utente alla domanda di conferma del recupero della password venga inviata al provider di appartenenze da verificare. L'implementazione predefinita genera l'evento VerifyingAnswer .

La generazione di un evento richiama il gestore eventi tramite un delegato. Per altre informazioni, vedere Gestione e generazione di eventi.

Il OnVerifyingAnswer metodo consente anche alle classi derivate di gestire l'evento senza associare un delegato. Questa è la tecnica preferita per gestire l'evento in una classe derivata.

Note per gli eredi

Quando si esegue l'override OnVerifyingAnswer(LoginCancelEventArgs) in una classe derivata, assicurarsi di chiamare il metodo della OnVerifyingAnswer(LoginCancelEventArgs) classe di base in modo che i delegati registrati ricevano l'evento.

Si applica a

Vedi anche