1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Clear session

Discussion in 'ASP' started by tsalexey544, Feb 17, 2007.

  1. tsalexey544

    tsalexey544 New Member

    Joined:
    Nov 18, 2006
    Messages:
    29
    Likes Received:
    0
    Trophy Points:
    0
    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?
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,285
    Likes Received:
    364
    Trophy Points:
    83
    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.
     

Share This Page