Bewerken

Delen via


IHttpSessionState.Abandon Method

Definition

Ends the current session.

public:
 void Abandon();
public void Abandon ();
abstract member Abandon : unit -> unit
Public Sub Abandon ()

Examples

The following code example implements the Abandon method of the IHttpSessionState interface. The code example duplicates the behavior of the HttpSessionStateContainer class in that it adds an IsAbandoned property that is set to true when the Abandon method is called. The IsAbandoned property is checked by the session-state module during the ReleaseRequestState event to determine whether the session has been abandoned, and the session-state module clears out session data and executes the Session_OnEnd event.

//
// Abandon marks the session as abandoned. The IsAbandoned property is used by the
// session state module to perform the abandon work during the ReleaseRequestState event.
//
public void Abandon()
{
  pAbandon = true;
}

public bool IsAbandoned
{
  get { return pAbandon; }
}
'
' Abandon marks the session as abandoned. The IsAbandoned property is used by the
' session state module to perform the abandon work during the ReleaseRequestState event.
'
Public Sub Abandon() Implements IHttpSessionState.Abandon
  pAbandon = True
End Sub

Public ReadOnly Property IsAbandoned As Boolean  
  Get
    Return pAbandon
  End Get
End Property

Remarks

The Abandon method is used to clear out session data and raise the Session_OnEnd event defined in the Global.asax file for the ASP.NET application.

Applies to

See also