ClientWindowsAuthenticationMembershipProvider ClientWindowsAuthenticationMembershipProvider ClientWindowsAuthenticationMembershipProvider ClientWindowsAuthenticationMembershipProvider Class

Definition

Enables Windows authentication with client application services.

public ref class ClientWindowsAuthenticationMembershipProvider : System::Web::Security::MembershipProvider
public class ClientWindowsAuthenticationMembershipProvider : System.Web.Security.MembershipProvider
type ClientWindowsAuthenticationMembershipProvider = class
    inherit MembershipProvider
Public Class ClientWindowsAuthenticationMembershipProvider
Inherits MembershipProvider
Inheritance
ClientWindowsAuthenticationMembershipProviderClientWindowsAuthenticationMembershipProviderClientWindowsAuthenticationMembershipProviderClientWindowsAuthenticationMembershipProvider

Examples

The following example code demonstrates how to use this method to authenticate a user by using Windows authentication. In this example, the value of the static Membership.Provider property is cast to a ClientWindowsAuthenticationMembershipProvider instance. This makes sure that a NullReferenceException will be thrown if you accidentally test this code by using another membership provider.

private bool ValidateUsingWindowsAuthentication()
{
    ClientWindowsAuthenticationMembershipProvider authProvider =
        System.Web.Security.Membership.Provider as
        ClientWindowsAuthenticationMembershipProvider;

    // Call ValidateUser and pass null values for the parameters.
    // This call always returns true.
    return authProvider.ValidateUser(null, null);
}
Private Function ValidateUsingWindowsAuthentication() As Boolean

    Dim authProvider As ClientWindowsAuthenticationMembershipProvider = _
        CType(System.Web.Security.Membership.Provider,  _
        ClientWindowsAuthenticationMembershipProvider)

    ' Call ValidateUser and pass Nothing for the parameters.
    ' This call always returns true.
    Return authProvider.ValidateUser(Nothing, Nothing)

End Function

Remarks

You can use client application services to validate users by using Windows authentication. To enable Windows authentication, you configure your application to use the ClientWindowsAuthenticationMembershipProvider class. For more information, see How to: Configure Client Application Services.

After configuration, you can validate users by calling the static Membership.ValidateUser method. The Membership.ValidateUser method internally calls the ValidateUser method.

The ClientWindowsAuthenticationMembershipProvider.ValidateUser method automatically authenticates the current user and sets the static Thread.CurrentPrincipal property to a ClientRolePrincipal object that contains the current WindowsIdentity. If a ClientRoleProvider is configured for your application, you can use the ClientRolePrincipal object to retrieve user role information from the roles service.

You can retrieve a reference to the current ClientWindowsAuthenticationMembershipProvider instance through the static Membership.Provider property. You can use the membership provider reference to call the ClientWindowsAuthenticationMembershipProvider.ValidateUser method directly. Additionally, you will need the membership provider reference to call the Logout method, which is not available in the MembershipProvider base class.

Constructors

ClientWindowsAuthenticationMembershipProvider() ClientWindowsAuthenticationMembershipProvider() ClientWindowsAuthenticationMembershipProvider() ClientWindowsAuthenticationMembershipProvider()

Initializes a new instance of the ClientWindowsAuthenticationMembershipProvider class.

Properties

ApplicationName ApplicationName ApplicationName ApplicationName

This property is not used by this class.

Description Description Description Description

Gets a brief, friendly description suitable for display in administrative tools or other user interfaces (UIs).

(Inherited from ProviderBase)
EnablePasswordReset EnablePasswordReset EnablePasswordReset EnablePasswordReset

This property is not used by this class.

EnablePasswordRetrieval EnablePasswordRetrieval EnablePasswordRetrieval EnablePasswordRetrieval

This property is not used by this class.

MaxInvalidPasswordAttempts MaxInvalidPasswordAttempts MaxInvalidPasswordAttempts MaxInvalidPasswordAttempts

This property is not used by this class.

MinRequiredNonAlphanumericCharacters MinRequiredNonAlphanumericCharacters MinRequiredNonAlphanumericCharacters MinRequiredNonAlphanumericCharacters

This property is not used by this class.

MinRequiredPasswordLength MinRequiredPasswordLength MinRequiredPasswordLength MinRequiredPasswordLength

This property is not used by this class.

Name Name Name Name

Gets the friendly name used to refer to the provider during configuration.

(Inherited from ProviderBase)
PasswordAttemptWindow PasswordAttemptWindow PasswordAttemptWindow PasswordAttemptWindow

This property is not used by this class.

PasswordFormat PasswordFormat PasswordFormat PasswordFormat

This property is not used by this class.

PasswordStrengthRegularExpression PasswordStrengthRegularExpression PasswordStrengthRegularExpression PasswordStrengthRegularExpression

This property is not used by this class.

RequiresQuestionAndAnswer RequiresQuestionAndAnswer RequiresQuestionAndAnswer RequiresQuestionAndAnswer

This property is not used by this class.

RequiresUniqueEmail RequiresUniqueEmail RequiresUniqueEmail RequiresUniqueEmail

This property is not used by this class.

Methods

ChangePassword(String, String, String) ChangePassword(String, String, String) ChangePassword(String, String, String) ChangePassword(String, String, String)

This method is not used by this class.

ChangePasswordQuestionAndAnswer(String, String, String, String) ChangePasswordQuestionAndAnswer(String, String, String, String) ChangePasswordQuestionAndAnswer(String, String, String, String) ChangePasswordQuestionAndAnswer(String, String, String, String)

This method is not used by this class.

CreateUser(String, String, String, String, String, Boolean, Object, MembershipCreateStatus) CreateUser(String, String, String, String, String, Boolean, Object, MembershipCreateStatus) CreateUser(String, String, String, String, String, Boolean, Object, MembershipCreateStatus) CreateUser(String, String, String, String, String, Boolean, Object, MembershipCreateStatus)

This method is not used by this class.

DecryptPassword(Byte[]) DecryptPassword(Byte[]) DecryptPassword(Byte[]) DecryptPassword(Byte[])

Decrypts an encrypted password.

(Inherited from MembershipProvider)
DeleteUser(String, Boolean) DeleteUser(String, Boolean) DeleteUser(String, Boolean) DeleteUser(String, Boolean)

This method is not used by this class.

EncryptPassword(Byte[]) EncryptPassword(Byte[]) EncryptPassword(Byte[]) EncryptPassword(Byte[])

Encrypts a password.

(Inherited from MembershipProvider)
EncryptPassword(Byte[], MembershipPasswordCompatibilityMode) EncryptPassword(Byte[], MembershipPasswordCompatibilityMode) EncryptPassword(Byte[], MembershipPasswordCompatibilityMode) EncryptPassword(Byte[], MembershipPasswordCompatibilityMode)

Encrypts the specified password using the specified password-compatibility mode.

(Inherited from MembershipProvider)
Equals(Object) Equals(Object) Equals(Object) Equals(Object)

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

(Inherited from Object)
FindUsersByEmail(String, Int32, Int32, Int32) FindUsersByEmail(String, Int32, Int32, Int32) FindUsersByEmail(String, Int32, Int32, Int32) FindUsersByEmail(String, Int32, Int32, Int32)

This method is not used by this class.

FindUsersByName(String, Int32, Int32, Int32) FindUsersByName(String, Int32, Int32, Int32) FindUsersByName(String, Int32, Int32, Int32) FindUsersByName(String, Int32, Int32, Int32)

This method is not used by this class.

GetAllUsers(Int32, Int32, Int32) GetAllUsers(Int32, Int32, Int32) GetAllUsers(Int32, Int32, Int32) GetAllUsers(Int32, Int32, Int32)

This method is not used by this class.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetNumberOfUsersOnline() GetNumberOfUsersOnline() GetNumberOfUsersOnline() GetNumberOfUsersOnline()

This method is not used by this class.

GetPassword(String, String) GetPassword(String, String) GetPassword(String, String) GetPassword(String, String)

This method is not used by this class.

GetType() GetType() GetType() GetType()

Gets the Type of the current instance.

(Inherited from Object)
GetUser(Object, Boolean) GetUser(Object, Boolean) GetUser(Object, Boolean) GetUser(Object, Boolean)

This method is not used by this class.

GetUser(String, Boolean) GetUser(String, Boolean) GetUser(String, Boolean) GetUser(String, Boolean)

This method is not used by this class.

GetUserNameByEmail(String) GetUserNameByEmail(String) GetUserNameByEmail(String) GetUserNameByEmail(String)

This method is not used by this class.

Initialize(String, NameValueCollection) Initialize(String, NameValueCollection) Initialize(String, NameValueCollection) Initialize(String, NameValueCollection)

Initializes the configuration builder.

(Inherited from ProviderBase)
Logout() Logout() Logout() Logout()

Logs out the user.

MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
OnValidatingPassword(ValidatePasswordEventArgs) OnValidatingPassword(ValidatePasswordEventArgs) OnValidatingPassword(ValidatePasswordEventArgs) OnValidatingPassword(ValidatePasswordEventArgs)

Raises the ValidatingPassword event if an event handler has been defined.

(Inherited from MembershipProvider)
ResetPassword(String, String) ResetPassword(String, String) ResetPassword(String, String) ResetPassword(String, String)

This method is not used by this class.

ToString() ToString() ToString() ToString()

Returns a string that represents the current object.

(Inherited from Object)
UnlockUser(String) UnlockUser(String) UnlockUser(String) UnlockUser(String)

This method is not used by this class.

UpdateUser(MembershipUser) UpdateUser(MembershipUser) UpdateUser(MembershipUser) UpdateUser(MembershipUser)

This method is not used by this class.

ValidateUser(String, String) ValidateUser(String, String) ValidateUser(String, String) ValidateUser(String, String)

Automatically authenticates the current user by using the identity supplied by the operating system.

Events

ValidatingPassword ValidatingPassword ValidatingPassword ValidatingPassword

Occurs when a user is created, a password is changed, or a password is reset.

(Inherited from MembershipProvider)

Applies to

See Also