AuthenticatingEventArgs.Password Właściwość

Definicja

Pobiera hasło użytkownika.

public:
 property System::String ^ Password { System::String ^ get(); };
public string Password { get; }
member this.Password : string
Public ReadOnly Property Password As String

Wartość właściwości

Hasło do weryfikacji.

Przykłady

Poniższy przykład przedstawia procedurę obsługi zdarzeń, która przekazuje UserName wartości i Password do niestandardowego dostawcy członkostwa w celu zweryfikowania poświadczeń użytkownika. Procedura obsługi zdarzeń ustawia Authenticated wartość zwracaną ValidateUser metody i ustawia AuthenticationIsComplete wartość na true , aby AuthenticationService klasa nie weryfikowała poświadczeń.

void AuthenticationService_Authenticating(object sender, System.Web.ApplicationServices.AuthenticatingEventArgs e)
{
    if (e.UserName.IndexOf("@contoso.com") >= 0)
    {
        e.Authenticated = Membership.Providers["ContosoSqlProvider"].ValidateUser(e.UserName, e.Password);
    }
    else if (e.UserName.IndexOf("@fabrikam.com") >= 0)
    {
        e.Authenticated = Membership.Providers["FabrikamSqlProvider"].ValidateUser(e.UserName, e.Password);
    }
    else
    {
        e.Authenticated = Membership.Provider.ValidateUser(e.UserName, e.Password);
    }
    e.AuthenticationIsComplete = true;
}
Sub AuthenticationService_Authenticating _
   (ByVal sender As Object, _
    ByVal e As System.Web.ApplicationServices.AuthenticatingEventArgs)
    
    If (e.Username.IndexOf("@contoso.com") >= 0) Then
        e.Authenticated = Membership.Providers("ContosoSqlProvider").ValidateUser(e.Username, e.Password)
    ElseIf (e.Username.IndexOf("@fabrikam.com") >= 0) Then
        e.Authenticated = Membership.Providers("FabrikamSqlProvider").ValidateUser(e.Username, e.Password)
    Else
        e.Authenticated = Membership.Provider.ValidateUser(e.Username, e.Password)
    End If
    e.AuthenticationIsComplete = True
End Sub

Uwagi

Właściwość służy do pobierania Password hasła podczas Authenticating zdarzenia.

Dotyczy

Zobacz też