Runs when a request starts.


<cffunction name="onRequestStart" returnType="boolean">
   <cfargument type="String" name="targetPage" required=true/>
   <cfreturn Boolean>

See also

onRequest, onRequestEnd, Method summary, Managing requests in Application.cfc in ColdFusion MX Developer's Guide


ColdFusion MX passes the following parameters to the method:

Parameters Description


Path from the web root to the requested page.


A Boolean value. Return False to prevent ColdFusion from processing the request. You do not need to explicitly return a True value if you omit the cffunction tag returntype attribute.


This method runs at the beginning of the request. It is useful for user authorization (login handling), and for request-specific variable initialization, such as gathering performance statistics.

If this method throws an exception (for example, if it uses the cfthrow tag), ColdFusion handles the error and does not process the request further.

If you call this method explicitly, ColdFusion does not start a request, but does execute the method code.

This method can access the requested page's Variables scope only if the Application.cfc file includes an onRequest method that calls the page. You can use Request scope variables to share data with the requested page even if Application.cfc does not have an onRequest method.


This example uses the authentication code generated by the ColdFusion MX Dreamweaver Login wizard to ensure that the user is logged in. For Beta 2, the wizard generates code that is appropriate for Application.cfm only. To use this code with the Application.CFC, delete the generated Application.CFM

<cffunction name="onRequestStart"> 
   <cfargument name="requestname" required=true/>
   <!--- Authentication code, generated by the Dreamweaver Login wizard.
   <cfinclude template="mm_wizard_application_include.cfm">
   <!--- Regular maintenance is done late at night. During those hours, tell
          people to come back later, and do not process the request further. --->
      if ((Hour(now()) gt 1) and (Hour(now()) lt 3)) {
         WriteOutput("The system is undergoing periodic maintenance. 
            Please return after 3:00 AM Eastern time.");
         return false;
      } else {
         return true;

ColdFusion 9 | ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | KnowledgeBase | Bug Reporting

Version 7