Assigning Session to nothing or Session.Abandon

I have seen so many developers once they wanted to destroy session, they used

Session(“A”) = Nothing

Its not a good practice to assign nothing object.

Correct:

 

Session.Abandon

 

The Session.Abandon method basically destroys a user session.

One thing I would add the current Session object will not delete untill the script on the current page have been processed completely.

Sorry for your inconvience, I have my official blog please visit for complete article:

http://blog.joggee.com/?p=143

 

 

 

 

 

About these ads

Posted on April 16, 2008, in ASp.NET 2005, ASP.NET Tips and tagged , , , . Bookmark the permalink. 2 Comments.

  1. Very useful tip. I will definitely use it.

  2. Wounderfull all most all the developers do so. Before readind this artical i also use same like
    Session(”A”) = Nothing
    Also FormsAuthentication.SignOut() is new thing for me.
    Thanks

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: