Sdílet prostřednictvím


SessionAuthenticationModule.SignOut Metoda

Definice

Odhlásí aktuálního uživatele a vyvolá přidružené události.

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

Příklady

Následující kód ukazuje kód pro vyvolání SignOut metody ze stránky SignOut.aspx (SignOut.aspx.cs) ve webové aplikaci ASP.NET. Úplnější příklad je uvedený v tématu s přehledem SessionAuthenticationModule .

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

Poznámky

OnSigningOutVyvolá metody , DeleteSessionTokenCookiea OnSignedOut k provedení odhlášení. Pokud dojde k výjimceOnSignOutError, je vyvolána metoda pro vyvolání SignOutError události. Můžete nastavit Cancel vlastnost objektu ErrorEventArgs předanou do obslužné rutiny události pro tuto událost, aby se zrušilo odhlášení a zabránilo se rozšíření výjimky do klienta.

Tuto metodu můžete přepsat a přidat tak chování specifické pro aplikaci.

Platí pro