AuthenticationService::ValidateUser Method (String^, String^, String^)

 

Authenticates user credentials without issuing an authentication ticket.

Namespace:   System.Web.ApplicationServices
Assembly:  System.Web.Extensions (in System.Web.Extensions.dll)

public:
[OperationContractAttribute]
bool ValidateUser(
	String^ username,
	String^ password,
	String^ customCredential
)

Parameters

username
Type: System::String^

The user name to be validated.

password
Type: System::String^

The password for the specified user.

customCredential
Type: System::String^

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

Return Value

Type: System::Boolean

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

Exception Condition
ArgumentNullException

userName or password is null.

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.

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

System_CAPS_noteNote

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.

.NET Framework
Available since 3.5
Return to top
Show: