Clear session

tsalexey544's Avatar, Join Date: Nov 2006
Go4Expert Member
Hi, I posted this question but somehow it is not here =(


When I release session objects I do this
Code:

Code:
session("username")=""

So whats the difference when I do this
Code:

Code:
set session("username")=nothing
or
session.remove("username")

Isn't I already release it with a null value?
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Session.Remove actually removes the key from the session collection, whereas setting the key = nothing, essentially does the same, but the key still exists in the collection. Performance wise, just setting the key value = nothing will be faster, as there really isn't a reason to remove the key, especially if later you may just add it back.