Login.OnAuthenticate メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > Login.OnAuthenticate メソッドの意味・解説 

Login.OnAuthenticate メソッド

メモ : このメソッドは、.NET Framework version 2.0新しく追加されたものです。

ユーザー認証する Authenticate イベント発生させます

名前空間: System.Web.UI.WebControls
アセンブリ: System.Web (system.web.dll 内)
構文構文

Protected Overridable Sub
 OnAuthenticate ( _
    e As AuthenticateEventArgs _
)
Dim e As AuthenticateEventArgs

Me.OnAuthenticate(e)
protected virtual void OnAuthenticate (
    AuthenticateEventArgs e
)
protected:
virtual void OnAuthenticate (
    AuthenticateEventArgs^ e
)
protected void OnAuthenticate (
    AuthenticateEventArgs e
)
protected function OnAuthenticate (
    e : AuthenticateEventArgs
)

パラメータ

e

イベント データ格納している AuthenticateEventArgs。

解説解説
使用例使用例

Authenticate イベント使用してサイト固有のカスタム認証コード呼び出すコード例次に示します

<%@ page language="VB" %>

<script runat="server">
    ' This custom login control overloads the OnAuthenticate method
    ' to call a site-specific authentication method.
    Class CustomLogin
        Inherits Login
        
        Private 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
    
        Overloads Sub OnAuthenticate(ByVal
 e As AuthenticateEventArgs)
            Dim Authenticated As Boolean
            Authenticated = SiteSpecificAuthenticationMethod(UserName, Password)

            e.Authenticated = Authenticated
        End Sub
    End Class
    
    ' Add the custom login control to the page.
    Sub Page_Load(ByVal sender As
 Object, ByVal e As EventArgs)
        Dim loginControl As New
 CustomLogin

        loginControl.ID = "loginControl"

        PlaceHolder1.Controls.Add(loginControl)
    End Sub

</script>

<html>
<body>
<form runat="server">
    <asp:placeholder id="PlaceHolder1" runat="server"></asp:placeholder>

</form>
</body>
</html>
<%@ page language="C#"%>
<script runat="server">
    // This custom login control overloads the OnAuthenticate method
    // to call a site-specific authentication method.    
    class CustomLogin : Login
    {
        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;
        }
        
        override protected void OnAuthenticate(AuthenticateEventArgs
 e)
        {
            bool Authenticated = false;
            Authenticated = SiteSpecificAuthenticationMethod(UserName, Password);

            e.Authenticated = Authenticated;
        }
    }
    
    // Add the custom login control to the page.
    void Page_Load(object sender, EventArgs e) 
    {
        CustomLogin loginControl = new CustomLogin();
        loginControl.ID = "loginControl";
        Placeholder1.Controls.Add(loginControl);
    }

</script>
<html>
    <body>
        <form runat="server">
            <asp:placeholder id="Placeholder1" runat="server"></asp:placeholder>
        </form>
    </body>
</html>
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

Login.OnAuthenticate メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



Login.OnAuthenticate メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS