Don't StructClear on Application or Session scopes. It kills keys that wont
be recreated :( do something like...
<CFSCRIPT>
Temp = StructNew();
if (StructKeyExists(Session, "CFID"))
Temp.CFID = Session.CFID;
if (StructKeyExists(Session, "CFTOKEN"))
Temp.CFTOKEN = Session.CFTOKEN;
if (StructKeyExists(Session, "SESSIONID"))
Temp.SESSIONID = Session.SESSIONID;
if (StructKeyExists(Session, "URLTOKEN"))
Temp.URLTOKEN = Session.URLTOKEN;
StructClear(Session);
// Restore the important values.
if (StructKeyExists(Temp, "CFID"))
Session.CFID = Temp.CFID;
if (StructKeyExists(Temp, "CFTOKEN"))
Session.CFTOKEN = Temp.CFTOKEN;
if (StructKeyExists(Temp, "SESSIONID"))
Session.SESSIONID = Temp.SESSIONID;
if (StructKeyExists(Temp, "URLTOKEN"))
Session.URLTOKEN = Temp.URLTOKEN;
</CFSCRIPT>
This is MX specific... You will need to lock the vars if you are using CF5 -
HTH
-----Original Message-----
From: Dave Wilson [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 18, 2003 13:44
To: CF-Talk
Subject: Is this normal session.sessionid behavior?
Hi all,
I've just noticed some rather strange behavior concerning the
session.sessionid variable.
Basically I have declared an application variable in Application.cfm which
stores an array of the form:
application.sessionref[session.sessionid] = session.sellcustomer
The array is used to help track which user (salesperson) is dealing with
which customer at any given time. Now, I have a very basic logout function
which utilises structclear(session) as part of it's "clean-up" operations
then redirects the user to the application login page. However, this results
in session.sessionid being entirely unavailable in the session scope, hence
rendering my app inaccessible due to the error thrown by Application.cfm.
The only way to return things to normal at this point is to restart the
Coldfusion server.
To clarify - the sessionid variable no longer exists within the session
scope after a structclear(session), despite my understanding that sessionid
is one of the cf built-in session variables. I'm not trying to retain the
value of the variable after logout (structclear) but simply wish for the
variable to be available immediately afterwards (in the newly constructed
session structure).
Anyone any ideas on this?
Environment: CFMX U3 on RH7.2 with Apache 2.0.43
Thanks,
Dave
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm?link=i:4:137462
Archives: http://www.houseoffusion.com/lists.cfm?link=t:4
Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Your ad could be here. Monies from ads go to support these lists and provide more
resources for the community.
http://www.fusionauthority.com/ads.cfm