【发布时间】:2019-10-01 14:03:26
【问题描述】:
我最近将一个应用从 CF2010 迁移到 CF2018,当用户登录时我们遇到了会话问题。
添加一些转储和中止我看到会话在有效登录时成功设置,但是在使用 cflocation 或 cfheader 时它会丢失会话(application.cfc 重新运行 onSessionStart)。我的 application.cfc 看起来像:
this.applicationTimeout = createTimeSpan(0,8,0,0);
this.sessionmanagement = true;
this.clientmanagement = false;
this.sessiontimeout = createTimeSpan(0,0,20,0);
this.scriptProtect = "all";
this.setClientCookies = true;
this.showDebugOutput = false;
this.enablecfoutputonly = false;
onSessionStart 非常简单:
public void function onSessionStart() {
lock scope="session" type="exclusive" timeout="10" {
session.started = now();
session.loggedIn = false;
};
lock scope="application" type="exclusive" timeout="5" {
application.sessions = application.sessions + 1;
};
writeLog(file = "g-session-log", type = "information", application = "no", text = "session started:");
};
在处理登录页面时,我可以看到日志文件获得了一个条目。在服务器管理员中,我选中了“使用 J2EE 会话变量”和“启用会话变量”。 Cookie 超时为 1440,选中 HTTPOnly 并选中“禁用使用 ColdFusion 标签/功能更新 ColdFusion 内部 cookie”。
【问题讨论】:
标签: coldfusion application.cfc