Skip navigation
Aidan Whitehall
Currently Being Moderated

cflocation within onRequestStart() *and* onRequestEnd() producing a concatenated URL

Apr 8, 2011 5:38 AM

I've writtten some code which stores the URL to which we want to redirect the user in a variable, rather than cflocating them immediately. This allows us to do subsequent code processing before the redirection actually occurs.

 

Sometimes I want redirection occur before any page processing is done (such as when the user must be taken to the "Change your password" page) -- in which case the cflocation is done as the last line in onRequestStart() -- and sometimes I want it to occur after the page has been processed (such as at the end of the page that processes their login) -- in which case the cflocation is done as the last line in onRequestEnd().

 

All was nice and sunny until we upgraded to 9.0.1.

 

In earlier versions, onRequestEnd() wasn't being executed and cflocation was therefore only being called once.

 

After upgrading, instead of the user being redirected to (say) "/options/", they are being redirected to (the invalid URL) "/options/,/options/". The URL appears to be being concatentated  (once when called from onRequestStart() and once from onRequestEnd() ) and  then sent to the client.

 

This change in behaviour is because of one of the issues fixed in Adobe® ColdFusion® 9.0 Update 1 (issue 80798, "The function onRequestEnd fails to execute when the tags cfabort or cflocation is used.")

 

Can I suggest an alteration be made in future versions or fixes? Either:

 

a) developers are enabled to programmatically determine the URL to which a cflocation has been issued (which would allow me to skip the call to cflocation in onRequestEnd() ), or

 

b) if a cflocation has been issued, ColdFusion doesn't honour any subsequent calls to cflocation.

 

Thanks.

 
Replies
  • Currently Being Moderated
    Apr 8, 2011 7:04 AM   in reply to Aidan Whitehall

    I suggest that you do a variation of a.  In other words, use a global boolean variable in your application.cfc.  Assign the appropriate value in your onRequestStart if you use cflocate.  In your onRequestEnd, use that value to decide what you are going to do.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points