Subject: Syncronizing Access to the Application Object
Posted By: AgentSmith Post Date: 7/2/2008 12:18:56 PM
I have a problem in my web app if two browsers are open to my site and both are in the same IIS web session.  To fix this I am giving each browser a seperate Hashtable to store what I was putting in the Session object. I'm storing at the Hashtable at the Application level.  Here is my question.

Each browser request will look for its Hashtable in the Application, if not found it creates one, stores it in the Application, and then updates a "LastAccessed" value in the Hashtable so I can tell when it was last touched.  A mechanism exists to remove Hashtables from Application if their "LastAccessed" is too old.

My question is, do I need to add special syncronization code around the Application object while inserting new Hashtables, modifying existing Hashtable values, and removing old Hashtables from the Cache?

Example.  If one thead is inserting into the Application one Hashtable, while another thread is removing an old Hashtable, could this cause any kind of concurrency problem or is it thread safe enough as is?

Go to topic 72459

Return to index page 1