ClientWindowsAuthenticationMembershipProvider.ValidateUser Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Automatically authenticates the current user by using the identity supplied by the operating system.
public:
override bool ValidateUser(System::String ^ username, System::String ^ password);
public override bool ValidateUser (string username, string password);
override this.ValidateUser : string * string -> bool
Public Overrides Function ValidateUser (username As String, password As String) As Boolean
Parameters
Returns
Always true
.
Exceptions
Examples
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
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
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.