TsgcWebSocketHTTPServerProperties › AutoStartSession

AutoStartSession 属性

当启用会话状态时,为每个传入请求自动创建新的 HTTP 会话。

语法

property AutoStartSession: Boolean read GetAutoStartSession write SetAutoStartSession;

默认值

False

备注

SessionStateAutoStartSession 均为 True 时,HTTP 服务器在首次看到没有有效会话 Cookie 的请求时,会自动分配一个新的 TIdHTTPSession(并触发 OnSessionStart),因此服务器代码无需显式调用 CreateSession()。如果您希望在处理程序代码中决定是创建会话还是拒绝请求,请将此项保留为 False。当 SessionStateFalse 时,此属性无效。

示例


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

返回属性