You are nearly there. Your session variables are not actually moving, they
are being "stolen". The web is "stateless". That means that once ColdFusion
and the web server complete each request - that's it - it doesn't know one
request from any other. To get around this ColdFusion offers client
management and the URLToken (or CFID/CFTOKEN). ColdFusion MX also adds the
new URLTokenFormat() function.

If you turn on "clientmanagement" in your Application.cfm and start
appending CFID/CFTOKEN to your URL's you will notice the differing number
appended to the end of the URL, eg:

http://www.mydomain.com/mypage.cfm?CFID=532578&CFTOKEN=83883880

If you have more than one "client" (browser) installed on your machine, eg:
IE, Netscape, Opera, Mozilla, etc, ColdFusion will assign a unique
CFID/CFTOKEN to each browser - this is how it can tell clients (not
sessions) apart. The easiest way to append the CFID/CFTOKEN to your URL's
is to use the URLTOKEN. eg:

<a href="" Link</a>

However just appending the URLToken to your URL's is not sufficient to
maintain this connection between your client and ColdFusion. You must also
append this URL token to this like CFLOCATION, CFCOOKIE or embed it into
your forms, eg:

1. Appending the URL token to a CFLOCATION re-direct:

<cflocation url="" addtoken="yes">

2. In a cookie (but never assume a user has cookies enabled):

<cfcookie name="URLToken" value="#URLToken#>

NOTE: in previous version of ColdFusion setting a cookie on the same page
you used a CFLOCATION meant the cookie would not be set. Under CFMX 6.1 the
cookie is now set regardless.

3. In a form example 1:

<form name="myform" action="" method="post">
</form>

4. In a form example 2 embedded as a hidden field:

<form name="myform" action="" method="post">
<input name="URLToken" type="hidden" value="#URLToken#">
</form>

If you remember to do this when you absolutely MUST maintain session state
you should be okay.

If you are running CFMX 6.1 a good place to read up about this is here:

http://livedocs.macromedia.com/coldfusion/6.1/htmldocs/sharedv9.htm

Peter Tilbrook
Transitional Services - Enterprise eSolutions
Centrelink (http://www.centrelink.gov.au)
2 Faulding Street
Symonston ACT 2609

Tel: (02) 62115927

                                                                                                                                       
                      "Michael E.                                                                                                      
                      Carluen"                 To:       CF-Talk <[EMAIL PROTECTED]>                                          
                      <[EMAIL PROTECTED]        cc:                                                                                    
                      om>                      Subject:  Re: 'Moving' Session variables                                                
                                                                                                                                       
                      04/02/2004 18:30                                                                                                
                      Please respond to |
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to