How to Tell if CFSCHEDULE is Calling Your Page
September 22nd, 2007
For one reason or another you may need to determine logically if a page you are coding is being called by CFSCHEDULE. The way I’ve done this in the past is by examining the CGI scope for the http_user_agent. I’m not sure about older or newer versions of ColdFusion, but with CFMX 7, ColdFusion passes “CFSCHEDULE” as the value. So in your code you could do something like:
1 2 3 4 5 | <cfif cgi.http_user_agent is "CFSCHEDULE"> This page is being called by CFSCHEDULE. <cfelse> This page is not being called by CFSCHEDULE. </cfif> |
Since it’s the job of the web browser (or any application requesting a web page) to pass the HTTP_USER_AGENT string, I would recommend against using this exclusively in any type of access or security function since someone could easily change their agent value to CFSCHEDULE. I’d love to hear what other ways people are doing this.