SessionAuthenticationModule.SignOut Método
Definição
Desconecta o usuário atual e gera os eventos associados.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 ()
Exemplos
O código a seguir mostra o código para invocar o SignOut método de uma página. aspx de entrada (SignOut. aspx. cs) em um aplicativo web ASP.net.The following code shows code for invoking the SignOut method from a SignOut.aspx page (SignOut.aspx.cs) in an ASP.NET web application. Um exemplo mais completo é mostrado no SessionAuthenticationModule tópico Visão geral.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);
}
Comentários
Invoca os OnSigningOut métodos, DeleteSessionTokenCookie e OnSignedOut para executar a saída. Se ocorrer uma exceção, o OnSignOutError método será invocado para gerar o SignOutError evento.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. Você pode definir a Cancel Propriedade do ErrorEventArgs objeto passado para o manipulador de eventos para esse evento para cancelar a saída e impedir que a exceção seja propagada para o cliente.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.
Você pode substituir esse método para adicionar o comportamento específico do aplicativo.You can override this method to add application-specific behavior.