共用方式為


UserValidatedEventArgs 類別

定義

提供 UserValidated 事件的資料。

public ref class UserValidatedEventArgs : EventArgs
public class UserValidatedEventArgs : EventArgs
type UserValidatedEventArgs = class
    inherit EventArgs
Public Class UserValidatedEventArgs
Inherits EventArgs
繼承
UserValidatedEventArgs

範例

下列範例程式代碼示範如何使用這個類別,在窗體的標題列中顯示用戶名稱。

private ClientFormsAuthenticationMembershipProvider formsMembershipProvider =
    (ClientFormsAuthenticationMembershipProvider)
    System.Web.Security.Membership.Provider;
private String appName = "ClientAppServicesDemo";

private void AttachUserValidatedEventHandler()
{
    formsMembershipProvider.UserValidated += 
        new EventHandler<UserValidatedEventArgs>(Form1_UserValidated);
}

private void Form1_UserValidated(object sender, UserValidatedEventArgs e)
{
    // Set the form's title bar to the application name and the user name.
    this.Text = String.Format("{0} ({1})", appName, e.UserName);
}
Private WithEvents formsMembershipProvider As  _
    ClientFormsAuthenticationMembershipProvider = _
    System.Web.Security.Membership.Provider

Private appName As String = "ClientAppServicesDemo"

Private Sub Form1_UserValidated(ByVal sender As Object, _
    ByVal e As UserValidatedEventArgs) _
    Handles formsMembershipProvider.UserValidated

    ' Set the form's title bar to the application name and the user name.
    Me.Text = String.Format("{0} ({1})", appName, e.UserName)

End Sub

備註

這個類別可讓您透過 UserName 屬性存取已驗證用戶的用戶名稱。

如需如何處理事件的詳細資訊,請參閱 處理和引發事件

建構函式

UserValidatedEventArgs(String)

初始化 UserValidatedEventArgs 類別的新執行個體。

屬性

UserName

取得所驗證之使用者的使用者名稱。

方法

Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
ToString()

傳回代表目前物件的字串。

(繼承來源 Object)

適用於

另請參閱