System.Web.SessionState.SessionIDManager.Encode Method

Encodes the session identifier for saving to either a cookie or the URL.

Syntax

public virtual string Encode (string id)

Parameters

id
The session identifier to encode.

Returns

The encoded session identifier.

Remarks

This method is not intended to be called from application code.

This method is used internally by the System.Web.SessionState.SessionIDManager class to encode custom HttpSessionState.SessionID values created by classes that inherit the System.Web.SessionState.SessionIDManager class and override the SessionIDManager.CreateSessionID(System.Web.HttpContext) and SessionIDManager.Validate(string) methods. To ensure the fidelity of a custom session-identifier value stored in the HTTP response by the SessionIDManager.SaveSessionID(System.Web.HttpContext, string, Boolean@, Boolean@) method, the System.Web.SessionState.SessionIDManager encodes the custom value using the erload:System.Web.HttpUtility.UrlEncode method.

For an example of a class that inherits the System.Web.SessionState.SessionIDManager class and overrides the SessionIDManager.CreateSessionID(System.Web.HttpContext) and SessionIDManager.Validate(string) methods, see the SessionIDManager.CreateSessionID(System.Web.HttpContext) method.

Requirements

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