从一个 application.cfm 到另一个 application.cfm 访问 Coldfusion 会话变量
我有一个登录功能,可以通过 xml web 服务对远程数据库进行授权。成功登录后,我为登录用户设置了一堆会话变量,这些变量在网站上跟随他们(仅限会员的内容等)。这一切都很好。
我们正在建立一家商店,希望能够访问会话变量,以进行会员定价、预填写表格等。目前,商店的链接仅在会员登录后才可用。我在链接中包含 url 令牌,如下所示:
https://mysite.com/store/index.cfm?<cfoutput>#session.urltoken#</cfoutput>
CFdumping 商店页面上的会话显示与登录页面相同的 cfid、cftoken 和 jsessionid ,所以我认为会话得到了正确的维护——但是我的会话变量都没有出现在转储中,如果我尝试引用它们,我会收到“会话中未定义”错误。
无论我通过 http > 从登录到存储,都会发生这种情况http、https > https 或其他组合。一切都在同一台服务器上。我将不胜感激解决此问题的任何帮助,或者如果有人对如何实现我们的目标有更好的建议,我也将非常感激!同样,我想做的就是让商店在登录会员第一次到达商店主页时识别出他们。多谢!
I have a login function that authorizes against a remote database over xml webservice. Upon successful login, I set a bunch of session variables for the logged-in user that follow them around the site (members only content, etc). This all works fine.
We are setting up a store and would like to have access to the session variables, for member pricing, pre-filling forms and so on. For now, the link to the store is available only after a member logs in. I am including the url token in the link, like so:
https://mysite.com/store/index.cfm?<cfoutput>#session.urltoken#</cfoutput>
CFdumping the session on the store page shows the same cfid, cftoken and jsessionid as from the login page, so I think the session is being correctly maintained -- but none of my session variables show up in the dump, and if I try to reference them I get the "is undefined in session" error.
This happens whether I go from login to store via http > http, https > https, or other combination. It's all on the same server. I would appreciate any help in resolving this, or if anybody has a better suggestion on how to accomplish our goal, I would really appreciate that too! Again, all I want to do is have the store recognize a logged-in member as such, when they first arrive at the store home page. Thanks a lot!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
两个应用程序需要具有相同的名称。
如果它们具有不同的名称,则所有应用程序会话变量都特定于该应用程序。
所以在 application.cfm 中确保名称已设置
如果您有任何可以在构造函数中使用 this.name 设置的 application.cfc 。
Both applications need to have the same name
If they have different names, then all application session variables are specific to that application.
so in application.cfm make sure name is set
if you have any application.cfc that might be set using this.name in the constructor.
您可以使用服务器范围。
复制到服务器会话中:
您可以只复制整个会话,但循环允许您保留源会话中不存在的值。
You can use server scope.
To copy into a servers session:
You could just copy the entire session, but looping allows you preserve values that aren't in the source session.