This documentation is archived and is not being maintained.

AuthenticationService::ValidateUser Method

Authenticates user credentials without issuing an authentication ticket.

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

[OperationContractAttribute]
public:
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.

ExceptionCondition
ArgumentNullException

userName or password is nullptr.

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.

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.

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5
Show: