Upraviť

Zdieľať cez


UserValidatedEventArgs Class

Definition

Provides data for the UserValidated event.

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

Examples

The following example code demonstrates how to use this class to display the user name in the title bar of a form.

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

Remarks

This class provides access to the user name of the validated user through the UserName property.

For more information about how to handle events, see Handling and Raising Events.

Constructors

UserValidatedEventArgs(String)

Initializes a new instance of the UserValidatedEventArgs class.

Properties

UserName

Gets the user name of the validated user.

Methods

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to

See also