ClientWindowsAuthenticationMembershipProvider.ValidateUser Method (String, String)


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

Namespace:   System.Web.ClientServices.Providers
Assembly:  System.Web.Extensions (in System.Web.Extensions.dll)

public override bool ValidateUser(
	string username,
	string password


Type: System.String

Must be Empty or null.

Type: System.String

Must be Empty or null.

Return Value

Type: System.Boolean

Always true.

Exception Condition

username is not Empty or null.


password is not Empty or null.

When you configure your application to use the ClientWindowsAuthenticationMembershipProvider class, the static Membership.ValidateUser method will use this method for its implementation. 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.

The following example code demonstrates how to use this method to authenticate a user by using Windows authentication.

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

    // Call ValidateUser and pass null values for the parameters.
    // This call always returns true.
    return authProvider.ValidateUser(null, null);

.NET Framework
Available since 3.5
Return to top
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
© 2015 Microsoft