Sys.Services AuthenticationService logout Method

Logs out the currently authenticated user.

Sys.Services.AuthenticationService.logout(redirectUrl, logoutCompletedCallback, failedCallback, userContext);





The URL to redirect the browser to on successful logout. The default is null.


The function that is called when the logout has finished. The default is null.


The function that is called if the logout has failed. The default is null.


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


If redirectUrl is null or is an empty string, the page is redirected to itself after the call to the authentication Web service finishes and the completed callback function is called. This makes sure that any user-related data is cleared from the page.

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. This 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 logout method to check the user's credentials. This code is part of a complete example found in the Sys.Services.AuthenticationService class overview.

// This function calls the logout method of the
// authentication service to clear the forms 
// authentication cookie.
function OnClickLogout() 
   // Clear the forms authentication cookie. 
        null, null, null); 

See Also


Sys.Services AuthenticationService login Method


Sys.Services.ProfileService Class

Sys.Net.WebServiceProxy Class