Whatever message this page gives is out now! Go check it out!

onRequestStart

Last update:
May 18, 2026

Description

Runs when a request starts.

Syntax

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

See also

onRequestonRequestEndMethod summaryManaging requests in Application.cfc in Defining the application and its event handlers in Application.cfc in the Developing ColdFusion Applications

Parameters

ColdFusion passes the following parameters to the method:
ParametersDescription
targetPage
Path from the web root to the requested page.

Returns

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.

Usage

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.

Example

This example uses the authentication code generated by the ColdFusion Dreamweaver Login wizard to ensure that the user is logged in. 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. ---> <cfscript> 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 { this.start=now(); return true; } </cfscript> </cffunction>

Share this page

Was this page helpful?
We're glad. Tell us how this page helped.
We're sorry. Can you tell us what didn't work for you?
Thank you for your feedback. Your response will help improve this page.

On this page