2 Replies Latest reply on Apr 8, 2011 7:04 AM by Dan Bracuk

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

    Aidan Whitehall

      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.