SessionIDManager.SessionIDMaxLength 属性

定义

获取有效会话标识符的最大长度。

public:
 static property int SessionIDMaxLength { int get(); };
public static int SessionIDMaxLength { get; }
static member SessionIDMaxLength : int
Public Shared ReadOnly Property SessionIDMaxLength As Integer

属性值

有效会话标识符的最大长度。

注解

会话标识符的最大长度为 80 个字符。

虽然 方法 CreateSessionID 创建的会话标识符长度为 24 个字符,但 类允许 SessionIDManager 的会话标识符的最大长度为 80 个字符。 如果实现自定义 SessionIDManager,这一点尤其重要。 方法 GetSessionID 从当前 HttpRequest检索会话标识符值,确保值不超过 SessionIDMaxLength 值,并且会话标识符是一个 24 个字符的字符串,通过调用 Validate 方法只包含小写字符 a 到 z 和数字 0 到 5。 如果实现继承 SessionIDManager 类的自定义SessionIDManager类并重写 CreateSessionID 方法而不是 Validate 方法,则自定义会话标识符值必须满足上述约束。 有关重写 SessionIDManager 类并实现这些方法的示例,请参阅为 CreateSessionID 方法提供的示例。

适用于

另请参阅