Reputation: 5905
I am wondering, is a singleton in asp.net session specific or is it shared between all user sessions?
Also does it remain alive until application is restarted, when a user session ends or when garbage collecting starts and clears memory from it as well.
Your input is highly appreciated.
Upvotes: 2
Views: 367
Reputation: 1500495
A traditional singleton - with a reference in a static variable - will live for as long as the AppDomain lives. It will not be session-oriented. It will be garbage collected when the AppDomain is recycled (or the app is shut down).
Upvotes: 4