Redigera

Dela via


SessionStateStoreProviderBase.SetItemExpireCallback Method

Definition

Sets a reference to the SessionStateItemExpireCallback delegate for the Session_OnEnd event defined in the Global.asax file.

public:
 abstract bool SetItemExpireCallback(System::Web::SessionState::SessionStateItemExpireCallback ^ expireCallback);
public abstract bool SetItemExpireCallback (System.Web.SessionState.SessionStateItemExpireCallback expireCallback);
abstract member SetItemExpireCallback : System.Web.SessionState.SessionStateItemExpireCallback -> bool
Public MustOverride Function SetItemExpireCallback (expireCallback As SessionStateItemExpireCallback) As Boolean

Parameters

expireCallback
SessionStateItemExpireCallback

The SessionStateItemExpireCallback delegate for the Session_OnEnd event defined in the Global.asax file.

Returns

true if the session-state store provider supports calling the Session_OnEnd event; otherwise, false.

Examples

For an example of a session-state store provider implementation, see Implementing a Session-State Store Provider.

Remarks

The SessionStateModule object calls the SetItemExpireCallback method when the module is initialized to determine whether calls to the Session_OnEnd event are supported by the SessionStateStoreProviderBase implementation and to associate the SessionStateItemExpireCallback delegate with the Session_OnEnd event.

Custom session-state store provider implementers should use the SetItemExpireCallback method to inform the SessionStateModule object whether calls to the Session_OnEnd event are supported and to set a local reference to the SessionStateItemExpireCallback delegate supplied by the expireCallback parameter. The custom implementation must decide when the local SessionStateItemExpireCallback delegate will be called. For example, the delegate could be called during the call to the RemoveItem method, which is called when a session is abandoned.

Applies to

See also