Copy link to clipboard
Copied
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,
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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,
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Thanks for the message and helping,
I use Dreamweave to build my ColdFusion web site application.
I create a local file using Dreamweaver, it seems that Dreamweave does not allow me to deploy application.cfm to ColdFusion server, it seems that application.cfc or application.cfm can not create a local file and Dreamweaver does not let me to publish.
Should I just create the file on the server to edit the file or I still can create a local file before delpoy to ColdFusion server?
Thanks again for helping,
Regards,
Iccsi
Copy link to clipboard
Copied
Sorry, my mistake, I am able to publish the application.cfm or application.cfc
Are there any particular reason to use application.cfc instead of application.cfm for new project?
Thanks again for helping,
Regards,
Iccsi
Copy link to clipboard
Copied
First, the name is case sensitive. You want a capital A.
Application.cfc will be more efficient than Application.cfm because if you use the latter, the entire file will be processed on every page request. With the former, only the code in onRequestStart and onRequestEnd will be processed.
There are probably other reasons but I don't know what they are.
Copy link to clipboard
Copied
Thanks a million for helping and information,
Regards,
Iccsi