views:

51

answers:

1

I have a problem in my asp.net application. The users can access a document, but only one user can access one document at the same time. When a user gets a document, a flag in the db is updated for the document, indicating that the document is in use. When the user finnishes working with the document, this flag is updated again to indicate that the document is not longer in use. The problem comes when the user has a document opened, and the session of the user expires; the db flag is not updated to indicate that the document is not in used. If the document is open by the same person that locked it (by changing the db flag), the document opens. The problem comes if the user that locked the document is different that the user that wants to open the document is different to the user the locked it. One approach that I used was to have a list of users that are logged in the application. If the user that has the doc locked is not currently logged in, them we know that the document is not longer in use, and we can open the document. The problem I am having is that when a new user logs in, I add the user ID to a list of users that are currently logged. When a session finnishes, the method Session_End in the Global.asax removes the user from the list, but the event does not always fires (not sure why, but aparently this is a known issue). Is there a way to force that event to execute when a Session expires, or, if someone has come accross a similar issue, can anyone point me to a different approach

Many thanks for your help guys Javier

A: 

Perhaps have a process that releases any open documents if they've been locked for a long time

Or maybe allow the second user to come and steel the lock if it's been locked for a certain time. This is similar to what svn does

Paul