SessionAuthenticationModule.SignOut Method

Definition

Signs the current user out and raises the associated events.

public:
 virtual void SignOut();
public virtual void SignOut ();
abstract member SignOut : unit -> unit
override this.SignOut : unit -> unit
Public Overridable Sub SignOut ()

Examples

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);
}

Remarks

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.

Applies to