CFLOCATION used to work by sending the http error code to force the browser
to redirect but it has been changed in MX, so now if you set a cookie before
it it will be returned to the browser where in previous versions it would
have been discarded.

Id always put a cfabort after a location just to be safe.

Alex

-----Original Message-----
From: Tim Blair [mailto:[EMAIL PROTECTED]
Sent: 11 November 2003 10:05
To: [EMAIL PROTECTED]
Subject: RE: [ cf-dev ] cflocation



> the thing that is diff between ASP and CF is that in ASP you cannot
> .redirect() if you have already sent stuff to the browser,
> but it seems you can get away with that in CF. Is there no
> buffer? everything is streamed to the browser as it's processed?

You can't use cflocation if you have already used cfflush (it will
simply ignore the cflocation statement and carry on regardless), but
otherwise cflocation automatically clears the buffer before sending the
response (CF sends a "moved temporarily" HTTP status code (302) which
tells the browser to go to the location specified in the Location
header.)

> at the point of cflocation the browser is forced to navigate away
> from the page, stopping any code from working after the cflocation
> page

Not true.  Just because the browser decides to go to another page
doesn't stop the code from running.  You may have seen this (for
example) if you write some code that takes a hellova long time to run
(infinite loop etc), get bored waiting and type in a new URL in the
browser window - you carry on as before but the script is still actually
running in the background.

I do not know the internal workings of cflocation, but I'm guessing it
simply sends the 302 message to the browser and ends processing of that
page there and then.  If you want to be sure, just stick a cfabort after
the cflocation  :)

Tim.

-------------------------------------------------------
RAWNET LTD - Internet, New Media and ebusiness Gurus.
Visit our new website at http://www.rawnet.com for
more information about our company, or call us free
anytime on 0800 294 24 24.
-------------------------------------------------------
Tim Blair
Web Application Engineer, Rawnet Limited
Direct Phone : +44 (0) 1344 393 441
Switchboard : +44 (0) 1344 393 040
-------------------------------------------------------
This message may contain information which is legally
privileged and/or confidential.  If you are not the
intended recipient, you are hereby notified that any
unauthorised disclosure, copying, distribution or use
of this information is strictly prohibited. Such
notification notwithstanding, any comments, opinions,
information or conclusions expressed in this message
are those of the originator, not of rawnet limited,
unless otherwise explicitly and independently indicated
by an authorised representative of rawnet limited.
-------------------------------------------------------



--
** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
For human help, e-mail: [EMAIL PROTECTED]





-- 
** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
For human help, e-mail: [EMAIL PROTECTED]

Reply via email to