ISessionIDManager Interface

 

Defines the contract that a custom session-state identifier manager must implement.

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

public interface class ISessionIDManager

NameDescription
System_CAPS_pubmethodCreateSessionID(HttpContext^)

Creates a unique session identifier.

System_CAPS_pubmethodGetSessionID(HttpContext^)

Gets the session identifier from the context of the current HTTP request.

System_CAPS_pubmethodInitialize()

Initializes the SessionIDManager object.

System_CAPS_pubmethodInitializeRequest(HttpContext^, Boolean, Boolean%)

Performs per-request initialization of the SessionIDManager object.

System_CAPS_pubmethodRemoveSessionID(HttpContext^)

Deletes the session identifier from the cookie or from the URL.

System_CAPS_pubmethodSaveSessionID(HttpContext^, String^, Boolean%, Boolean%)

Saves a newly created session identifier to the HTTP response.

System_CAPS_pubmethodValidate(String^)

Confirms that the supplied session identifier is valid.

The ISessionIDManager interface identifies the methods that you must implement to create a custom manager for session-identifier values. An ISessionIDManager interface implementation creates and validates session-identifier values, and manages the storage of a session identifier in the HTTP response as well as the retrieval of a session-identifier value from the HTTP request. You enable the custom session-ID manager using the sessionIDManagerType attribute of the sessionState Element (ASP.NET Settings Schema) configuration element.

If your ISessionIDManager interface implementation will support cookieless session identifiers, you will need to implement a solution for sending and retrieving session identifiers in the URL, such as an ISAPI filter.

If you only want to supply custom session-identifier values to be used by ASP.NET session state, you can create a class that inherits the SessionIDManager class and override only the CreateSessionID and Validate methods with your own custom implementation. This enables you to supply your own session-identifier values, while relying on the base SessionIDManager class to store values to the HTTP response and retrieve values from the HTTP request. For an example of overriding the SessionIDManager class and implementing these methods, see the example provided for the CreateSessionID method of the SessionIDManager class.

The following code example shows a class that implements a cookie-based session-ID manager.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 2.0
Return to top
Show: