AuthenticateEventArgs 類別
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
提供 Authenticate 事件的資料。
public ref class AuthenticateEventArgs : EventArgs
C#
public class AuthenticateEventArgs : EventArgs
type AuthenticateEventArgs = class
inherit EventArgs
Public Class AuthenticateEventArgs
Inherits EventArgs
- 繼承
下列程式代碼範例會 AuthenticateEventArgs 使用 類別將數據傳遞至自定義驗證方法。
ASP.NET (C#)
<%@ 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>
類別 AuthenticateEventArgs 提供事件所需的 Authenticate 數據。 網站的自訂驗證配置會使用 Authenticated 屬性來指出使用者的登入嘗試是否成功。
Authenticate |
將 AuthenticateEventArgs 屬性設定成 |
Authenticate |
初始化 AuthenticateEventArgs 類別的新執行個體。 |
Authenticated |
取得或設定值,指出使用者的驗證嘗試是否成功。 |
Equals(Object) |
判斷指定的物件是否等於目前的物件。 (繼承來源 Object) |
Get |
做為預設雜湊函式。 (繼承來源 Object) |
Get |
取得目前執行個體的 Type。 (繼承來源 Object) |
Memberwise |
建立目前 Object 的淺層複製。 (繼承來源 Object) |
To |
傳回代表目前物件的字串。 (繼承來源 Object) |
產品 | 版本 |
---|---|
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |