Singletons in Web Apps

As I understand it, a shared property on a class is shared across all sessions.

I would like to create a singleton class that is available only in each session (each session has its own copy but only one).

Is this possible? The alternative, I suppose is to create a property in the session and reference that.


You could have a global or App-resident Dictionary object and use Session ID as a key.


This does to seem be an improvement over adding a property to the session.

Am I missing something?

Just do that. Singleton pattern doesn’t really apply if you need an instance for each session.