ערוך

שתף באמצעות


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
ClientWindowsAuthenticationMembershipProvider

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.

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()

Initializes a new instance of the ClientWindowsAuthenticationMembershipProvider class.

Properties

ApplicationName

This property is not used by this class.

Description

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

(Inherited from ProviderBase)
EnablePasswordReset

This property is not used by this class.

EnablePasswordRetrieval

This property is not used by this class.

MaxInvalidPasswordAttempts

This property is not used by this class.

MinRequiredNonAlphanumericCharacters

This property is not used by this class.

MinRequiredPasswordLength

This property is not used by this class.

Name

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

(Inherited from ProviderBase)
PasswordAttemptWindow

This property is not used by this class.

PasswordFormat

This property is not used by this class.

PasswordStrengthRegularExpression

This property is not used by this class.

RequiresQuestionAndAnswer

This property is not used by this class.

RequiresUniqueEmail

This property is not used by this class.

Methods

ChangePassword(String, String, String)

This method is not used by this class.

ChangePasswordQuestionAndAnswer(String, String, String, String)

This method is not used by this class.

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

This method is not used by this class.

DecryptPassword(Byte[])

Decrypts an encrypted password.

(Inherited from MembershipProvider)
DeleteUser(String, Boolean)

This method is not used by this class.

EncryptPassword(Byte[], MembershipPasswordCompatibilityMode)

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

(Inherited from MembershipProvider)
EncryptPassword(Byte[])

Encrypts a password.

(Inherited from MembershipProvider)
Equals(Object)

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

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

This method is not used by this class.

FindUsersByName(String, Int32, Int32, Int32)

This method is not used by this class.

GetAllUsers(Int32, Int32, Int32)

This method is not used by this class.

GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetNumberOfUsersOnline()

This method is not used by this class.

GetPassword(String, String)

This method is not used by this class.

GetType()

Gets the Type of the current instance.

(Inherited from Object)
GetUser(Object, Boolean)

This method is not used by this class.

GetUser(String, Boolean)

This method is not used by this class.

GetUserNameByEmail(String)

This method is not used by this class.

Initialize(String, NameValueCollection)

Initializes the configuration builder.

(Inherited from ProviderBase)
Logout()

Logs out the user.

MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
OnValidatingPassword(ValidatePasswordEventArgs)

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

(Inherited from MembershipProvider)
ResetPassword(String, String)

This method is not used by this class.

ToString()

Returns a string that represents the current object.

(Inherited from Object)
UnlockUser(String)

This method is not used by this class.

UpdateUser(MembershipUser)

This method is not used by this class.

ValidateUser(String, String)

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

Events

ValidatingPassword

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

(Inherited from MembershipProvider)

Applies to

See also