I am trying to perform a cflocation tag inside of the application.cfc within the onRequestStart function and keep getting an error.
If I leave out the cflocation tag from within the conditional recordcount tag, the pages will open fine. But once I include the cflocation tag, I get an error.
I am trying to run a query on every page to check some details about a User. If the checkuser function comes back with a recordcount greater than 0, i want to direct the user to a specific page no matter where in the site the user was browsing.
I would appreciate it if anyone has a clue why I am getting an error.
Code Sample Below:
<cffunction name="onRequestStart" output="false" returnType="void">
<cfinvoke component="#APPLICATION.somepath#" method="checkUser" returnvariable="checkUser">
<cfinvokeargument name="User_code" value="#SESSION.User_code#">
<cfif checkUser.recordcount GT 0>
<cflocation url="../index.cfm" addtoken="no">