TsgcWebSocketHTTPServerProperties › SessionState

SessionState 属性

在无状态 HTTP 协议之上启用基于 Cookie 的 HTTP 会话跟踪。

语法

property SessionState: Boolean read GetSessionState write SetSessionState;

默认值

False

备注

SessionState 设置为 True,允许 HTTP 服务器为每个客户端分配会话 ID,并在 SessionList 集合中维护每用户状态。OnSessionStartOnSessionEndOnCreateSessionOnInvalidSession 事件为实现登录流程提供挂钩点。调整 SessionTimeOut 以控制空闲过期,并结合 AutoStartSession 在首次请求时自动创建会话。请参阅 HTTP 服务器会话主题以获取完整演示。

示例


oServer := TsgcWebSocketHTTPServer.Create(nil);
oServer.SessionState := true;
oServer.AutoStartSession := true;
oServer.Active := true;

返回属性