问题描述
如果用户关闭了Web浏览器,则会自动删除会话历史记录,但是我必须在我的数据库中更新它是否仍然在会话中
If user closed the web browser then automatically session history is erased, but I have to update it in my database whether user still in the session or not
推荐答案
<script type="text/javascript">
function onWindowClosing() {
if (window.event.clientX < 0 || window.event.clientY < 0) {
然后在您的帐户
控制器你必须实现方法 OnWindowClosing
来保存你想要的东西。
在我的下一篇文章中: []我还提供了源代码,您可以看到上述事件的完整实现。尤其要看 _Layout.cshtml
布局页面和 AccountController
类。
Then in your Account
controller you have to implement the method OnWindowClosing
to save what you want.
In my next article: MVC Basic Site: Step 4 – jqGrid Integration in MVC 4.0 using AJAX, JSON, jQuery, LINQ, and Serialization[^] I have provided also source code, and you can see the complete implementation of the above events. Have a look especially on _Layout.cshtml
layout page and on AccountController
class.
这篇关于用户关闭浏览器时如何自动注销的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!