A singleton in a web application seems to have scope through the app domain.
That is, different instances of a web site can access the same value.
Should I use singleton's in a web application?
I was thinking of using one to encapsulate session[] objects but this isn't
possible if it is shared.
How would this work on a web farm?
Any ideas?
Jason
A singleton is merely a pattern or technique and is not necessarily tied to
an appDomain (although typically is). It really depends on what you are
trying to achieve eg. you may create a singleton for the entire system, or
only for that process, or only for that appDomain, or even within a
particular context
> That is, different instances of a web site can access the same value.
Can you explain this further. Do you mean different instances of different
web apps on the same machine?
Singletons are fine to use in web apps, provided they suit your specific
problem.
Typically, in a web farm scenario, one instance of the singleton object
exists in each appDomain on each server in the farm. Again, this is
generalising but I think it answers your question.

Signature
- Paul Glavich
ASP.NET MVP
ASPInsider (www.aspinsiders.com)
> A singleton in a web application seems to have scope through the app domain.
> That is, different instances of a web site can access the same value.
[quoted text clipped - 8 lines]
> Any ideas?
> Jason