ASP.Net使用文档
我的 ASP.NET 应用程序有问题。 用户可以访问一份文档,但同一时间只有一个用户可以访问一份文档。 当用户获取文档时,数据库中的标志会针对该文档进行更新,指示该文档正在使用中。 当用户完成对文档的处理时,该标志会再次更新以指示该文档不再使用。 当用户打开了一个文档,并且该用户的会话过期时,就会出现问题; db 标志未更新以指示该文档未被使用。 如果文档由锁定该文档的同一个人打开(通过更改 db 标志),则该文档将打开。 如果锁定文档的用户与想要打开文档的用户与锁定文档的用户不同,就会出现问题。 我使用的一种方法是获取登录应用程序的用户列表。 如果锁定文档的用户当前未登录,我们就知道该文档不再使用,并且可以打开该文档。 我遇到的问题是,当新用户登录时,我将用户 ID 添加到当前登录的用户列表中。 当会话结束时,Global.asax 中的 Session_End 方法会从列表中删除用户,但该事件并不总是触发(不确定原因,但显然这是一个已知问题)。 有没有办法在会话过期时强制执行该事件,或者,如果有人遇到类似的问题,任何人都可以向我指出不同的方法
非常感谢您的帮助 哈维尔
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许有一个流程可以释放所有已锁定很长时间的打开文档,
或者如果已锁定一段时间,则可以允许第二个用户来解锁。 这与 svn 的作用类似
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