When to unload Session obejects

J

jorge

Hi all,

When should I remove objects that I have put in my session. The consumer of
the control does not know anything about the control. I HAVE to put this
guys in the session.

Also,
I need to know if a Button.Click event has been fired BEFORE a
TextBox.TextChanged event gets fired. Which is not the way it works right
now. (The control is a Composite control)

/ jorge
 
S

Scott Allen

Ideally, the runtime will remove objects from the session after the
session times out (if it times out), and the objects are garbage
collected. You really can't be proactive about it, particularly from
the persepctive of a control author.
 
J

jorge

Ack! The event mechanism of ASP.NET should change. Any extensions to the
framework that are worth looking at?

/ jorge
 
J

John Saunders

jorge said:
Ack! The event mechanism of ASP.NET should change. Any extensions to the
framework that are worth looking at?

Why do you need your Session objects removed sooner?

You could handle the Session_End event in global.asax and remove things at
that time. I suggested to another poster that he try iterating through
Session, checking each object to see if it implements IDisposable, and
calling IDisposable.Dispose() on it if it does. Maybe that will help you.
 
A

Alvin Bruney [MVP]

First, stop posting this to so many groups.

Session times out automatically, you do not need to explicitly remove them.
If you are trying to be efficient with memory, set the session expiration
lean. The default is 20 minutes.
 

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

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top