Skip to main content
Inspiring
Mar 12, 2013 1:20 PM UTC
Answered

common file to store variable

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 is closed to new replies. Start a new post to keep the conversation going.
    duncancummingCorrect answer
    Participating Frequently
    Mar 12, 2013 1:36 PM UTC

    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.

    7 replies

    duncancummingCorrect answer
    Participating Frequently
    Mar 12, 2013 1:36 PM UTC

    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.

    Translate
    iccsiAuthor
    Inspiring
    Mar 12, 2013 1:46 PM UTC

    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,

    Translate
    Inspiring
    Mar 12, 2013 4:31 PM UTC

    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.

    Translate