Share via


Sys.Services AuthenticationService login Method

Authenticates the user's credentials.

Sys.Services.AuthenticationService.login(userName, password, isPersistent, customInfo, redirectUrl, loginCompletedCallback, failedCallback, userContext);

Parameters

Parameter

Description

userName

(required) The user name to authenticate.

password

The user's password. The default is null.

isPersistent

true if the issued authentication ticket should be persistent across browser sessions; otherwise, false. The default is false.

redirectUrl

The URL to redirect the browser to on successful authentication. If null, no redirect occurs. The default is null.

customInfo

Reserved for future use. The default is null.

loginCompletedCallback

The function to call when the login has finished successfully. The default is null.

failedCallback

The function to call if the login fails. The default is null.

userContext

User context information that you are passing to the callback functions.

Exceptions

Exception type

Condition

Sys.ArgumentNullException

username is null.

Remarks

If redirectUrl is null or is an empty string, the current page is not refreshed after the call to the authentication Web service finishes. Instead, if the Web service call succeeds, the login-completed function is called.

If redirectUrl is not null or is a non-empty string, the page is redirected to the specified URL after a successful call to the Web service. The redirection URL can be an absolute virtual path, a relative virtual path, or a fully qualified domain name and a path.

If the call to the Web service fails, the page is not redirected or refreshed. Instead, the failed-callback function is called.

Example

The following example shows how to use the login method to check the user's credentials. This code is part of a complete example found in the Sys.Services.AuthenticationService class overview.

See Also

Concepts

Sys.Services.ProfileService Class

Sys.Net.WebServiceProxy Class

Reference

Sys.Services AuthenticationService logout Method