Application.cfm and OnRequestEnd.cfm

Contact Us or call 1-877-932-8228
Application.cfm and OnRequestEnd.cfm

Application.cfm and OnRequestEnd.cfm

Whenever a ColdFusion page is called, the ColdFusion Application Server checks the current directory for a file called Application.cfm. If Application.cfm is not found in the current directory, ColdFusion looks for the file in the parent directory and continues to look up the tree until it gets to the root directory of the file system. As soon as the file is found, ColdFusion stops looking up the tree and prepends the found Application.cfm to the called page.

Application.cfm is often used for the following tasks:

  • Control state management variables and set the application name with <cfapplication>.
  • Set default global variables such as data source names and file paths.
  • Set custom error handling using <cferror>.

Application.cfm should not used for including code to be output to the browser, such as a common header.

When and only when an Application.cfm file is found, ColdFusion will also look for a file called OnRequestEnd.cfm in the same directory. If it finds OnRequestEnd.cfm it will append it to the called file. OnRequestEnd.cfm is sometimes used for outputting debugging information or logging information about the page.