0 out of 1 rated this helpful - Rate this topic

SessionIDManager Class

Manages unique identifiers for ASP.NET session state.

System.Object
  System.Web.SessionState.SessionIDManager

Namespace:  System.Web.SessionState
Assembly:  System.Web (in System.Web.dll)
public class SessionIDManager : ISessionIDManager

The SessionIDManager type exposes the following members.

  Name Description
Public method SessionIDManager Creates an instance of the SessionIDManager class.
Top
  Name Description
Public property Static member SessionIDMaxLength Gets the maximum length of a valid session identifier.
Top
  Name Description
Public method CreateSessionID Creates a unique session identifier for the session.
Public method Decode Decodes a URL-encoded session identifier obtained from a cookie or the URL.
Public method Encode Encodes the session identifier for saving to either a cookie or the URL.
Public method Equals(Object) Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method GetSessionID Gets the session-identifier value from the current Web request.
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Public method Initialize Initializes the SessionIDManager object with information from configuration files.
Public method InitializeRequest Performs per-request initialization of the SessionIDManager object.
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method RemoveSessionID Deletes the session-identifier cookie from the HTTP response.
Public method SaveSessionID Saves a newly created session identifier to the HTTP response.
Public method ToString Returns a string that represents the current object. (Inherited from Object.)
Public method Validate Gets a value indicating whether a session identifier is valid.
Top

The SessionIDManager class is an HTTP module that manages unique session identifiers for use with ASP.NET session state. The unique identifier for an ASP.NET session is the SessionID property, which can be accessed from the Session property of the current HttpContext or Page. The ASP.NET session identifier is a randomly generated number encoded into a 24-character string consisting of lowercase characters from a to z and numbers from 0 to 5.

By default, the SessionID value is sent in a cookie with each request to the ASP.NET application. The name of the cookie that contains the SessionID value is ASP.NET_SessionId by default. You can configure a different cookie name by setting the cookieName attribute of the sessionState Element (ASP.NET Settings Schema) to the desired cookie name.

If you want to disable the use of cookies in your ASP.NET application and still make use of session state, you can configure your application to store the session identifier in the URL instead of a cookie by setting the cookieless attribute of the sessionState element to true in the Web.config file for your application. For more information, see the IsCookieless property.

Notes to Inheritors

You can replace the ASP.NET session identifier with your own custom session identifier by creating a class that inherits the SessionIDManager class and overriding the CreateSessionID and Validate methods with your own custom implementations. For an example of overriding the SessionIDManager class and implementing these methods, see the example provided for the CreateSessionID method.

You can replace the entire SessionIDManager with a custom session-ID manager by creating a class that implements the ISessionIDManager interface. If your custom session-ID manager supports cookieless session identifiers, you will need to implement a solution for sending and retrieving session identifiers in the URL, such as an ISAPI filter. For more information about creating a custom session-ID manager, see ISessionIDManager.

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ