Skip to main content
WolfShade
Legend
May 2, 2016 4:39 PM UTC
Question

Setting application variables in onRequestStart???

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 is closed to new replies. Start a new post to keep the conversation going.

4 replies

EddieLotter
Inspiring
May 3, 2016 4:15 PM UTC

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

Cheers

Eddie

Translate
Carl Von Stetten
Legend
May 2, 2016 4:47 PM UTC

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.

Translate
WolfShade
WolfShadeAuthor
Legend
May 2, 2016 4:54 PM UTC

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,

^_^

Translate
EddieLotter
Inspiring
May 3, 2016 4:13 PM UTC

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

Translate