Export (0) Print
Expand All

SessionStateStoreProviderBase.GetItemExclusive Method

Returns read-only session-state data from the session data store.

Namespace: System.Web.SessionState
Assembly: System.Web (in system.web.dll)

public abstract SessionStateStoreData GetItemExclusive (
	HttpContext context,
	string id,
	out bool locked,
	out TimeSpan lockAge,
	out Object lockId,
	out SessionStateActions actions
)
public abstract SessionStateStoreData GetItemExclusive (
	HttpContext context, 
	String id, 
	/** @attribute OutAttribute() */ /** @ref */ boolean locked, 
	/** @attribute OutAttribute() */ /** @ref */ TimeSpan lockAge, 
	/** @attribute OutAttribute() */ /** @ref */ Object lockId, 
	/** @attribute OutAttribute() */ /** @ref */ SessionStateActions actions
)
Not applicable.

Parameters

context

The HttpContext for the current request.

id

The SessionID for the current request.

locked

When this method returns, contains a Boolean value that is set to true if a lock is successfully obtained; otherwise, false.

lockAge

When this method returns, contains a TimeSpan object that is set to the amount of time that an item in the session data store has been locked.

lockId

When this method returns, contains an object that is set to the lock identifier for the current request. For details on the lock identifier, see "Locking Session-Store Data" in the SessionStateStoreProviderBase class summary.

actions

When this method returns, contains one of the SessionStateActions values, indicating whether the current session is an uninitialized, cookieless session.

Return Value

A SessionStateStoreData populated with session values and information from the session data store.

The SessionStateModule object calls the GetItemExclusive method at the beginning of a request, during the AcquireRequestState event, when the EnableSessionState attribute is set to true, which is the default. If the EnableSessionState attribute is set to ReadOnly, the SessionStateModule object instead calls the GetItem method.

The GetItemExclusive method returns a SessionStateStoreData object populated with session information from the data store, updates the expiration date of the stored data, and locks the session-item data at the data store for the duration of the request. If no session-item data is found at the data store, the GetItemExclusive method sets the locked out parameter to false and returns a null reference (Nothing in Visual Basic). This causes the SessionStateModule object to call the CreateNewStoreData method to create a new session item in the data store. If session-item data is found at the data store but the data is locked, the GetItemExclusive method sets the locked out parameter to true, sets the lockAge out parameter to the current date and time minus the date and time when the item was locked (which is retrieved from the data store), sets the lockId out parameter to the lock identifier retrieved from the data store, and returns a null reference (Nothing in Visual Basic). This causes the SessionStateModule object to call the GetItemExclusive method again after a half-second interval to attempt to retrieve the session-item information and obtain a lock on the data. If the value that the lockAge out parameter is set to exceeds the ExecutionTimeout value, then the SessionStateModule calls the ReleaseItemExclusive method to clear the lock on the session-item data, and then calls the GetItemExclusive method again.

The actionFlags parameter is used when the cookieless and regenerateExpiredSessionId attributes are both set to true. An actionFlags value set to InitializeItem indicates that the entry in the session data store is a new session that requires initialization. Uninitialized entries in the session data store are created by a call to the CreateUninitializedItem method. If the item from the session data store is not an uninitialized item, the actionFlags parameter will be set to zero.

Custom session-state store implementers that support cookieless sessions should set the actionFlags out parameter to the value returned from the session data store for the current item. If the actionFlags parameter value for the requested session-store item equals the InitializeItem enumeration value, then the GetItemExclusive method should set the value in the data store to zero after setting the actionFlags out parameter.

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

Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions

ADD
Show:
© 2014 Microsoft