HttpSessionState.Abandon 方法


取消当前会话。Cancels the current session.

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


Abandon调用方法后, 当前会话将不再有效, 可以启动新的会话。Once the Abandon method is called, the current session is no longer valid and a new session can be started. Abandon导致引发End事件。Abandon causes the End event to be raised. 下一个Start请求将引发一个新事件。A new Start event will be raised on the next request.

默认情况下, 将回收被放弃或过期会话的会话标识符。Session identifiers for abandoned or expired sessions are recycled by default. 也就是说, 如果发出的请求包括已过期或已放弃的会话的会话标识符, 则使用相同的会话标识符启动一个新会话。That is, if a request is made that includes the session identifier for an expired or abandoned session, a new session is started using the same session identifier. 可以通过将sessionState配置元素regenerateExpiredSessionId的属性设置为来true禁用此设置。You can disable this by setting regenerateExpiredSessionId attribute of the sessionState configuration element to true. 有关详细信息, 请参阅会话标识符For more information, see Session Identifiers.

End InProc当属性设置为时, 才支持该事件。 ModeThe End event is supported only when the Mode property is set to InProc.