Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to display all session variables (and structures)

Status
Not open for further replies.

jkellow

Programmer
Aug 1, 2000
6
US
I have tried everything I can find on the subject but
can't seem to find how to show every session variable and
any session structure(with keys and values).
Following is latest attempt it displays variables fine
but blows on structures. I have tried IsStruct everyway but the right way. Thanks JimK

<CFLOOP COLLECTION=#SESSION# ITEM=&quot;counter&quot;>
<CFOUTPUT>
<cfif IsStruct(session[counter])>
<CFSET keysToStruct = StructKeyArray(session[counter])>
<cfset stx = #session[counter]#>
structure key name is #stx#--values follow...<br>
<CFLOOP index=&quot;i&quot; from=&quot;1&quot; to=&quot;#ArrayLen(keysToStruct)#&quot;>
Key#i# is #keysToStruct# Value#i# is #session[counter][keysToStruct]#<br>
</cfloop>
<cfset temp = session[counter]>
<CFSET keysToStruct = StructKeyArray(temp)>
<CFLOOP index=&quot;i&quot; from=&quot;1&quot; to=&quot;#ArrayLen(keysToStruct)#&quot;>
Key#i# is #keysToStruct# Value#i# is #temp[keysToStruct]#<br>
</CFLOOP>
<cfelse>
#counter# (Value - #session[counter]#)<BR>
</cfif>
</CFOUTPUT>
</CFLOOP>
 
try all instances of changing #session# to #session.sessionid#.

bankholdup
 
of course i mean:
try changing all instance of #session# to
#session.sessionid#.

and no i'm not smoking anything!

bankholdup
 
Did you by any chance try what you are asking me to do?
I did copy/paste, changed only the occurances of #session
as you said but alas, got following message from CF.
Thanks jkellow

Error Occurred While Processing Request
Error Diagnostic Information
Loop error

Invalid collection #SESSION.sessionid# - must be a valid struct or COM object

The error occurred while processing an element with a general identifier of (CFLOOP), occupying document position (39:1) to (39:54) in the template file E:\InetPub\
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top