Login.Password 속성

정의

사용자가 입력한 암호를 가져옵니다.

public:
 virtual property System::String ^ Password { System::String ^ get(); };
[System.ComponentModel.Browsable(false)]
public virtual string Password { get; }
[<System.ComponentModel.Browsable(false)>]
member this.Password : string
Public Overridable ReadOnly Property Password As String

속성 값

사용자가 입력한 암호입니다. 기본값은 null입니다.

특성

예제

다음 코드 예제에서는 Password 사용자 지정 인증 방법에 속성을 전달 합니다.

<%@ 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>

설명

속성에는 Password 사용자가 입력한 암호가 포함됩니다. 암호는 텍스트가 지워집니다. 자세한 내용은 웹 애플리케이션에 대 한 기본 보안 사례합니다.

참고

또는 Password 속성을 프로그래밍 방식으로 조작 UserName 하는 경우 페이지 수명 주기 동안 올바른 시간에 이 작업을 수행하는 것이 중요합니다. 및 PasswordUserName 값은 단계 중에 Page_Load 사용할 수 없지만 단계 중에 Pre_Render 는 사용할 수 있습니다.

Login 같은 입력란에서 표시 하는 속성을 제어할 UserNamePassword, 페이지 수명 주기의 모든 단계 동안 액세스할 수 있습니다. 컨트롤을 이용 하 여 최종 사용자가 변경한 모든 내용을 선택 된 TextChanged 된 텍스트 상자에 의해 트리거되는 이벤트입니다.

적용 대상

추가 정보