Skip to main content
WolfShade
Legend
May 2, 2016
Question

Setting application variables in onRequestStart???

  • May 2, 2016
  • 2 replies
  • 413 views

Hello, all,

I'm working on some legacy code that I inherited from a long-gone developer (he left about two years ago.)

For some reason, the developer is setting application variables in the onRequestStart() section of application.cfc.

I was under the impression that application variables were set when the server is first started, or comes back from a reboot, or similar situation.  Yet until recently, this application was running without a hitch.

Am I crazy?  Obviously the variables are working, but I didn't think it would.

V/r,

^_^

This topic has been closed for replies.

2 replies

EddieLotter
Inspiring
May 3, 2016

P.S. To answer your question, yes, you're crazy.

Cheers

Eddie

Carl Von Stetten
Legend
May 2, 2016

Application variables can be set anywhere in your application, including in .CFM files. You might be thinking of the this scope in Application.cfc, which can only be set in the pseudo-constructor portion of Application.cfc.

WolfShade
WolfShadeAuthor
Legend
May 2, 2016

Hi, Carl,

Okay.  I just thought that anything set in the application scope would be ignored unless/until a reboot or reinit.  I just never saw anyone set application variables like that, before.  But, if it works..

V/r,

^_^

EddieLotter
Inspiring
May 3, 2016

I recommend that you read the Developing CFML Applications -> About Applications section of the "Developing ColdFusion Applications" document linked on the ColdFusion Help page. It contains important concepts that you need to understand about the application scope.

Cheers

Eddie