Skip to main content
Inspiring
March 12, 2013
Answered

common file to store variable

  • March 12, 2013
  • 1 reply
  • 1010 views

I am going to start a new project using ColdFusion and would like to have a common file to store my variables.

I would like to know does ColdFusion have any specific file to store like Web.Config for ASP.Net or I can have my own file name?

Your help and information is great appreciated,

Regards,

Iccsi,

    This topic has been closed for replies.
    Correct answer duncancumming

    You can have a file called whatever you like and just cfinclude it.  However you may be better of simply using onApplicationStart (and/or onSessionStart, onRequestStart) in your application.cfc and creating your variables directly within there.  Application.cfc (and application.cfm) are the closest ColdFusion has to a 'common' file - these are called from all page requests that go through the ColdFusion server.

    1 reply

    duncancummingCorrect answer
    Participating Frequently
    March 12, 2013

    You can have a file called whatever you like and just cfinclude it.  However you may be better of simply using onApplicationStart (and/or onSessionStart, onRequestStart) in your application.cfc and creating your variables directly within there.  Application.cfc (and application.cfm) are the closest ColdFusion has to a 'common' file - these are called from all page requests that go through the ColdFusion server.

    iccsiAuthor
    Inspiring
    March 12, 2013

    Thanks for the informaiton and help,

    Should I have application.cfc and application.cfm on the root directory or the files must be on the ColdFusion server only?

    Thanks again,

    Regards,

    Iccsi,

    Inspiring
    March 12, 2013

    You have Application.cfc or Application.cfm, but not both.  Since it's a new project,  suggest Application.cfc. 

    Regarding your question about location, I don't understand.  Root Directories and ColdFusion servers are not mutually exclusive.