将会话范围确定为 Coldfusion 应用程序的特定部分?

发布于 2024-10-07 09:34:00 字数 232 浏览 0 评论 0原文

有没有办法通过使用会话启用程序将 Application.cfm 添加到其目录中来仅为 Coldfusion 应用程序的特定部分启用会话?

例如,具有以下内容的网站:

  • /extranet
  • /intranet
  • /store
  • /rentals

我想在租赁部分使用会话变量,独立于 Intranet 和商店中的会话变量。

Is there a way to enable sessions for just a specific part of the Coldfusion application by just adding Application.cfm into its directory with the session enablers?

For example, a website that has the following:

  • /extranet
  • /intranet
  • /store
  • /rentals

I want to use session variables in the rental section, independent of the ones in the intranet and store.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

箜明 2024-10-14 09:34:00

如果您不想想要共享会话变量,也不需要共享应用程序变量,那么这很简单。只需将不同的 Application.cfc(或 .cfm)放入您想要访问会话变量的上下文的根目录中即可。

因此,如果您希望 /extranet 中的会话和 /intranet 中的会话并且不希望它们是同一应用程序,那么:

/extranet/Application.cfc:

component {
    this.name = "extranet";
    this.sessionmanagement = true;
}

/intranet/Application.cfc:

component {
    this.name = "intranet";
    this.sessionmanagement = true;
}

听起来您并不是真的了解您可以使用 Application.cfc 执行的所有操作,因此我还将添加 这是一个非常好的参考。有很多东西需要学习,但一旦你了解了它是如何工作的,它也很简单。

If you don't want to share session variables, and don't need to share application variables, then it's easy. Just put a different Application.cfc (or .cfm) in the root of the context for which you want access to the session variables.

So if you want sessions in /extranet, and sessions in /intranet and don't want them to be the same application, then:

/extranet/Application.cfc:

component {
    this.name = "extranet";
    this.sessionmanagement = true;
}

/intranet/Application.cfc:

component {
    this.name = "intranet";
    this.sessionmanagement = true;
}

It sounds like you aren't really up to speed on all of the things that you can do with Application.cfc, so I'll also add that this is a really good reference. There is a lot to learn, but it is also pretty simple once you understand how it works.

无畏 2024-10-14 09:34:00

也许单点登录 (SSO) 解决方案适合您?与其乱搞会话结构中的值,只需将用户 ID 从一个应用程序传递到另一个应用程序即可。当用户从 Extranet 转到租赁时,应用程序会说“用户 #45 来了”,租赁应用程序在数据库中查找它们,进行一些验证以确保用户就是 Extranet 所说的用户,然后启动他们在租金方面有新的经历。

Maybe a Single Signon (SSO) solution would work for you? Rather than monkey around with the values in the session struct, just pass a user id from one app to another. When the user passes from extranet to rentals, the app says "here comes user #45", the rentals app looks them up in the db, does some validation to make sure that the user is who the extranet says they are, then starts a new session for them in rentals.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文