Skip to main content
Inspiring
March 24, 2008
Question

Redirect in Non-Executed Code

  • March 24, 2008
  • 3 replies
  • 383 views
I have a scheduled task that calls the page: Reports/kpi/random_report_requests.cfm (just like that, copied the extension from CF Administrator)

I start the code like this:
<cfif not isDefined("test")>
<cfset test = 1>
</cfif>

And during the scheduled task everything works fine until this block of code:
<cfif not test>
<cflocation url="../dgim/ap_performance.cfm">
</cfif>

The page is redirected to ap_performance.cfm and those processes are run. Does cflocation override procedural code? This is in CF4.5

Thanks!

This topic has been closed for replies.

3 replies

Participating Frequently
March 24, 2008
I know there are already some issues with CFlocation but this is something weird.

You can try to use JavaScript for page forwarding instead of cflocation.
kodemonkiAuthor
Inspiring
March 24, 2008
Oguz, thank you for your reply, but I use this syntax regularly and have never had an issue like this, but I have never called cflocation inside a statement like that either.
Participating Frequently
March 24, 2008
In your case it looks like test = 1

In the code <cfif not test> it returns 0 and your include must not work.

If it works this would be because of the version of CF and handling the cfif block.

I would suggest to put direct reference and compare with 1 as

<cfif test NEQ 1>

I hope this helps.