ASP.Net使用文档

发布于 2024-07-30 05:18:51 字数 538 浏览 6 评论 0原文

我的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

罗罗贝儿 2024-08-06 05:18:51

也许有一个流程可以释放所有已锁定很长时间的打开文档,

或者如果已锁定一段时间,则可以允许第二个用户来解锁。 这与 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文