Contents > Developing ColdFusion MX Applications > Using Persistent Data and Locking > Configuring and using session variables > Creating and deleting session variables PreviousNext

Creating and deleting session variables

Use a standard assignment statement to create a new session variable, as follows:

<cflock timeout=20 scope="Session" type="Exclusive">
   <cfset Session.ShoppingCartItems = 0>
</cflock>

Use the structdelete tag to delete a session variable; for example:

<cflock timeout=20 scope="Session" type="Exclusive">
   <cfset StructDelete(Session, "ShoppingCartItems")>
</cflock>

Note: If you set session variables on a CFML template that uses the cflocation tag, ColdFusion might not set the variables. For more information, see Macromedia TechNote 22712 at www.macromedia.com/v1/Handlers/index.cfm?ID=22712&Method=Full.


Contents > Developing ColdFusion MX Applications > Using Persistent Data and Locking > Configuring and using session variables > Creating and deleting session variables PreviousNext

ColdFusion 9 | ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | Bug Reporting

Version 6.1

Comments are no longer accepted for ColdFusion MX 6.1. ColdFusion 8 is the current version.