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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

deleting session variable

Status
Not open for further replies.

karren

Programmer
Feb 26, 2002
42
CA
hi all,

i am having a problem where i am not able to delete a session variable. the session variable that i'm using is session.sessionID, so the number is automatically generated by the server. i've put the sessiontimeout as 30 minutes. the code i'm using to delete the session.sessionID variable is:

<cflock timeout=&quot;30&quot; name=&quot;session&quot; type=&quot;exclusive&quot;>
<cfset StructDelete(session,&quot;session.sessionID&quot;)>
</cflock>

another question i have is, is it possible that the server will generate the same session.sessionID the next time you come on the page, even after its deleted?

thanks all! :)

karren
 
ColdFusion sets the session.sessionid automatically, so unless you want to disable session management, you are not going to be successful getting rid of it ;)

I have to ask, why do you want to delete the sessionid? If you have a user logged in, you can set a specific session variable to identify that (e.g. session.IsLoggedIn), then delete that session variable when they log out, or use StructClear() on the session scope if you want to clear all of your set session variables.

If you have a reason to delete the cookies when the session is over, too, you can do that using cfcookie, but if there is no reason for that (and there usually isn't), just let the cookies persist. CF will generate new cookies anyway, so there isn't really a difference.

-Tek
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top