SessionAuthenticationModule.SignOut Method

.NET Framework 4.5

Signs the current user out and raises the associated events.

Namespace:  System.IdentityModel.Services
Assembly:  System.IdentityModel.Services (in System.IdentityModel.Services.dll)

public virtual void SignOut()

Invokes the OnSigningOut, DeleteSessionTokenCookie, and OnSignedOut methods to perform sign-out. If an exception occurs, the OnSignOutError method is invoked to raise the SignOutError event. You can set the Cancel property of the ErrorEventArgs object passed into the event handler for this event to cancel the sign-out and prevent the exception from being propagated to the client.

You can override this method to add application-specific behavior.

The following code shows code for invoking the SignOut method from a SignOut.aspx page (SignOut.aspx.cs) in an ASP.NET web application. A more complete example is shown in the SessionAuthenticationModule overview topic.

void Application_Start(object sender, EventArgs e)
{
    // Code that runs on application startup 

    //SUBSCRIBE TO SAM EVENTS
    FederatedAuthentication.SessionAuthenticationModule.SessionSecurityTokenCreated += new EventHandler<SessionSecurityTokenCreatedEventArgs>(SessionAuthenticationModule_SessionSecurityTokenCreated);
    FederatedAuthentication.SessionAuthenticationModule.SessionSecurityTokenReceived += new EventHandler<SessionSecurityTokenReceivedEventArgs>(SessionAuthenticationModule_SessionSecurityTokenReceived);
    FederatedAuthentication.SessionAuthenticationModule.SigningOut += new EventHandler<SigningOutEventArgs>(SessionAuthenticationModule_SigningOut);
    FederatedAuthentication.SessionAuthenticationModule.SignedOut += new EventHandler(SessionAuthenticationModule_SignedOut);
    FederatedAuthentication.SessionAuthenticationModule.SignOutError += new EventHandler<ErrorEventArgs>(SessionAuthenticationModule_SignOutError);
}

.NET Framework

Supported in: 4.6, 4.5
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2015 Microsoft