Singleton Class in Asp.net application
-
Hi there, I am new to asp.net :) . I want to use a singleton class in asp.net application. Scenario is as following: A user from GroupA and some users from GroupB login to application. I want to use a singleton class to keep info of all logged in users in above scenario. So i can exchange information/data among users through that class. Is that possible:confused:? Assuming that most users will be logged in at same time or fixed time interval. Thanks.
-
Hi there, I am new to asp.net :) . I want to use a singleton class in asp.net application. Scenario is as following: A user from GroupA and some users from GroupB login to application. I want to use a singleton class to keep info of all logged in users in above scenario. So i can exchange information/data among users through that class. Is that possible:confused:? Assuming that most users will be logged in at same time or fixed time interval. Thanks.
What is it you're asking exactly? Are you asking how to implement a singleton, or if a monolithic session tracker/message bus is a good idea (it's not)?
"There are three kinds of lies: lies, damned lies and statistics." - Benjamin Disraeli
-
What is it you're asking exactly? Are you asking how to implement a singleton, or if a monolithic session tracker/message bus is a good idea (it's not)?
"There are three kinds of lies: lies, damned lies and statistics." - Benjamin Disraeli
Thanks 4 ur reply. I know how to implement and use singleton class. I want to know, will it work in my scenario?
-
Thanks 4 ur reply. I know how to implement and use singleton class. I want to know, will it work in my scenario?
It will work as long as all users are accessing the site in the same app domain, so on a single machine you'll be ok but your solution won't scale. You'll need to consider threading issues too as the same objects will be being read\written at the same time.