แก้ไข

แชร์ผ่าน


AuthenticationService.ValidateUser(String, String, String) Method

Definition

Authenticates user credentials without issuing an authentication ticket.

public:
 bool ValidateUser(System::String ^ username, System::String ^ password, System::String ^ customCredential);
[System.ServiceModel.OperationContract]
public bool ValidateUser (string username, string password, string customCredential);
[<System.ServiceModel.OperationContract>]
member this.ValidateUser : string * string * string -> bool
Public Function ValidateUser (username As String, password As String, customCredential As String) As Boolean

Parameters

username
String

The user name to be validated.

password
String

The password for the specified user.

customCredential
String

The value or values to validate in addition to username and password, if any.

Returns

true if the user credentials are valid; otherwise, false.

Attributes

Exceptions

userName or password is null.

Remarks

The ValidateUser method authenticates the user credentials but does not set an authentication cookie. Without an authentication cookie, the user will not be logged in even if the credentials are valid.

Use the ValidateUser method when you must check whether a user's credentials are valid without receiving an authentication cookie. For example, you might do this if the authentication cookie is already stored in a client application but you want to verify that the user's credentials are still valid when a new session starts.

The ValidateUser method raises the Authenticating event, but does not raise the CreatingCookie event.

Note

Do not call the ValidateUser method from code that is executing on the Web server. You call the ValidateUser method only as part of a WCF service. For more information, see ASP.NET Authentication.

Applies to

See also