问题描述
有没有办法让 ColdFusion 应用程序知道它是从调度程序运行还是从浏览器运行?理想情况下,我想设置一个 Session 标志,例如 Application.cfm 中的isScheduled",以便在整个应用程序中使用.
Is there a way for a ColdFusion app to know whether it is being run from the scheduler vs. from a browser? Ideally, I'd like to set a Session flag, for instance "isScheduled" in Application.cfm to be used throughout the app.
编辑我最终检查了用户代理,它正在本地运行(以提高安全性),并且(因为它在 Application.cfm 中运行)该页面位于允许调度的文件夹中:
EDITI ended up checking the user agent, and that it is being run locally (to improve security), and (since it is running in Application.cfm) that the page is in the folder which allows scheduling:
Request.isScheduled = FindNoCase("CFSCHEDULE",CGI.HTTP_USER_AGENT)和 (Find("10.",CGI.REMOTE_ADDR)==1或 Find("198.162.",CGI.REMOTE_ADDR)==1)和 FindNoCase("scheduled",CGI.CF_TEMPLATE_PATH);
推荐答案
检查用户代理.用户代理是CFSCHEDULE",但请先确认.
Check for the user agent. The user agent is "CFSCHEDULE" but please confirm this first.
这篇关于Coldfusion:检测是否正在由调度程序运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!