User Guide
Chapter 12: Using the Application Framework 185
Custom error handling
Using the CFERROR tag, you can display customized HTML pages when errors occur.
This allows you to maintain a consistent look and feel within your application even
when errors occur. It also allows you to optionally suppress the display of error
information.
See “Generating Custom Error Messages (CFERROR)” on page 93 for more
information.
Web server security integration
You can integrate your applications with the user authentication and security provided
by your Web server. In addition, the ColdFusion Server offers a security framework that
controls access to applications, pages, data sources, and users. You set the bounds of a
security domain using the CFAUTHENTICATE tag.
See Chapter 17, “Application Security,” on page 263 for more information.
Mapping Out an Application Framework
An important step in designing a ColdFusion application is mapping out its directory
structure.
Before you start building the application, establish a root directory for the application.
Application pages may be stored in subdirectories of the root directory.
When any ColdFusion application page is requested, ColdFusion searches up the
page's directory tree for an
Application.cfm file. When it is found, the
Application.cfm code is logically included at the beginning of that page.
If it is not found, ColdFusion searches up the directory tree until it finds an
Application.cfm file. If more than one Application.cfm file lives in the current
directory tree, ColdFusion uses the first one it finds.
Just as the Application.cfm file is executed before each application page it governs,
you can specify a file named
OnRequestEnd.cfm, which is executed after each
application page in the same application.
ColdFusion Server looks for the OnRequestEnd.cfm file in the same directory as the
Application.cfm file of the current application page. The OnRequestEnd.cfm file will
never be executed if it resides in another directory.
The OnRequestEnd.cfm file will not be executed if there is an error or an exception in
the called page, or if the called page executes the CFABORT or CFEXIT tag.
Just as the Application.cfm file must be spelled with a capital A, you must spell the
OnRequestEnd.cfm file with capital O, R, and E.
Defining a root directory for an application has a number of advantages: