AuthenticateEventArgs Classe

Définition

Fournit des données pour l'événement Authenticate.

public ref class AuthenticateEventArgs : EventArgs
public class AuthenticateEventArgs : EventArgs
type AuthenticateEventArgs = class
    inherit EventArgs
Public Class AuthenticateEventArgs
Inherits EventArgs
Héritage
AuthenticateEventArgs

Exemples

L’exemple de code suivant utilise la AuthenticateEventArgs classe pour passer des données à une méthode d’authentification personnalisée.

<%@ 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">
private bool SiteSpecificAuthenticationMethod(string UserName, string Password)
{
    // Insert code that implements a site-specific custom 
    // authentication method here.
    //
    // This example implementation always returns false.
    return false;
}

private void OnAuthenticate(object sender, AuthenticateEventArgs e)
{
    bool Authenticated = false;
    Authenticated = SiteSpecificAuthenticationMethod(Login1.UserName, Login1.Password);

    e.Authenticated = Authenticated;
}

</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
        <form id="form1" runat="server">
            <asp:Login id="Login1" runat="server"
                OnAuthenticate="OnAuthenticate">
            </asp:Login>
        </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">
Function SiteSpecificAuthenticationMethod(ByVal UserName As String, ByVal Password As String) As Boolean
    ' Insert code that implements a site-specific custom 
    ' authentication method here.
    '
    ' This example implementation always returns false.
    Return False
End Function

Sub OnAuthenticate(ByVal sender As Object, ByVal e As AuthenticateEventArgs)
    Dim Authenticated As Boolean
    Authenticated = SiteSpecificAuthenticationMethod(Login1.UserName, Login1.Password)

    e.Authenticated = Authenticated
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">
            <asp:Login id="Login1" runat="server"
                OnAuthenticate="OnAuthenticate">
            </asp:Login>

        </form>
    </body>
</html>

Remarques

La AuthenticateEventArgs classe fournit les données nécessaires à l’événement Authenticate . Les schémas d’authentification personnalisés pour un site Web utilisent la Authenticated propriété pour indiquer si la tentative de connexion d’un utilisateur a réussi.

Constructeurs

AuthenticateEventArgs()

Initialise une nouvelle instance de la classe AuthenticateEventArgs avec la propriété Authenticated définie avec la valeur false.

AuthenticateEventArgs(Boolean)

Initialise une nouvelle instance de la classe AuthenticateEventArgs.

Propriétés

Authenticated

Obtient ou définit une valeur indiquant si la tentative d'authentification d'un utilisateur a réussi.

Méthodes

Equals(Object)

Détermine si l'objet spécifié est égal à l'objet actuel.

(Hérité de Object)
GetHashCode()

Fait office de fonction de hachage par défaut.

(Hérité de Object)
GetType()

Obtient le Type de l'instance actuelle.

(Hérité de Object)
MemberwiseClone()

Crée une copie superficielle du Object actuel.

(Hérité de Object)
ToString()

Retourne une chaîne qui représente l'objet actuel.

(Hérité de Object)

S’applique à

Voir aussi