Asp.Net and Session - some Interesting Facts

V

vikram.lakhotia

Hi,
Yesterday I was discussion with my colleagues about session and a few
interesting things popped up. So I thought I would share the same with
all.

<a href=http://www.vikramlakhotia.com/
A_few_interesting_things_about_session_in_AspNet.aspx>
http://www.vikramlakhotia.com/A_few_interesting_things_about_session_in_AspNet.aspx</a>

Vikram
<A href=http://www.vikramlakhotia.com> http://www.vikramlakhotia.com</a>
<A href=http://JustLikeThat.vikramlakhotia.com>http://
JustLikeThat.vikramlakhotia.com</a>
<A href=http://WhyNot.vikramlakhotia.com>http://
WhyNot.vikramlakhotia.com</a>
 
?

=?ISO-8859-1?Q?G=F6ran_Andersson?=

Hi,
Yesterday I was discussion with my colleagues about session and a few
interesting things popped up. So I thought I would share the same with
all.

<a href=http://www.vikramlakhotia.com/
A_few_interesting_things_about_session_in_AspNet.aspx>
http://www.vikramlakhotia.com/A_few_interesting_things_about_session_in_AspNet.aspx</a>

> Session Class has two methods. Session.Abondon() and Session.Clear().
> Both the methods are used to clear the data in the session. Both the
> methods clear the data in the session.

No, they don't. Session.Clear removes the session variables, but
Session.Abandon doesn't remove anything at all from the session, it only
flags the session object to be abandoned after the request has been handled.
> But there is one difference between them. Session.Abondon() will
> Session_end event will be fired and session_start event will be fired
> on the next request.

Yes, of course. Abandoning the session will end it, and the next request
will start a new session. Clearing the session variables doesn't end the
session.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top