SessionStateStoreProviderBase.CreateUninitializedItem Method

Adds a new session-state item to the data store.

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

public abstract void CreateUninitializedItem (
	HttpContext context,
	string id,
	int timeout
)
public abstract void CreateUninitializedItem (
	HttpContext context, 
	String id, 
	int timeout
)
public abstract function CreateUninitializedItem (
	context : HttpContext, 
	id : String, 
	timeout : int
)
Not applicable.

Parameters

context

The HttpContext for the current request.

id

The SessionID for the current request.

timeout

The session Timeout for the current request.

The CreateUninitializedItem method is used with sessions when the cookieless and regenerateExpiredSessionId attributes are both true. Having the regenerateExpiredSessionId attribute set to true causes the SessionStateModule object to generate a new SessionID value when an expired SessionID value is encountered.

The process of generating a new SessionID value requires redirecting the browser to a URL that contains the newly generated SessionID value. The CreateUninitializedItem method is called during the initial request that contains an expired SessionID value. After the SessionStateModule object acquires a new SessionID value to replace the expired value, it calls the CreateUninitializedItem method to add an uninitialized entry to the session-state data store. The browser is then redirected to the URL containing the newly generated SessionID value. The existence of the uninitialized entry in the session data store ensures that the redirected request that includes the newly generated SessionID value is not mistaken for a request for an expired session and is, instead, treated as a new session.

The uninitialized entry in the session data store is associated with the newly generated SessionID value and contains only default values, including an expiration date and time and a value that corresponds to the actionFlags parameter of the GetItem and GetItemExclusive methods. The uninitialized entry in the session-state store should include an actionFlags value equal to the InitializeItem enumeration value. This value is passed to the SessionStateModule object by the GetItem and GetItemExclusive methods, and informs the SessionStateModule object that the current session is a new but uninitialized session. The SessionStateModule object will then initialize the new session and raise the Session_OnStart event.

For more information about cookieless sessions, see the IsCookieless property.

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: