This documentation is archived and is not being maintained.

Sys.Services AuthenticationService login Method

Visual Studio 2008

Authenticates the user's credentials.

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




(required) The user name to authenticate.


The user's password. The default is null.


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


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


Reserved for future use. The default is null.


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


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


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

Exception type



username is null.

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.

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.