在不使用任何类型会话的情况下,在Sql Server DataBase中保存登录和LogOut记录 [英] Save Login and LogOut Records in Sql Server DataBase without use of any type session

查看:59
本文介绍了在不使用任何类型会话的情况下,在Sql Server DataBase中保存登录和LogOut记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我是asp.net的新手,需要一点帮助。我正在一个网站上工作这个网站有一个用户登录页面。我想在数据库中保存用户登录和出网站时的记录。我对Global.asax有一些了解。我希望在Global.asax中解雇

Hi,
I am new in asp.net, need a bit help. I am working on a website this website Have a user Login page. I want save a records in database who User login and when goes out website.I have some idea about the Global.asax. I Want save the records when fire

Session_End()

时保存记录。我对这个问题一无所知。感谢您的帮助Advanced。

in Global.asax. I don't have any idea about this problem. Thanks for help Advanced.

推荐答案

您可以使用Session_Start()在登录时进行存储,但我建议您使用登录页面并在登录验证码中执行逻辑相反。



Session_End()不保证会触发。因为Web是断开连接的介质,所以无法确保用户没有登录。如果您确实需要知道谁登录,您可以做什么,用户每次请求都会更新表,表明他们已登录然后,您可以查看表格,查看在最后x分钟内未提出请求的任何人。
You can use Session_Start() to store when they login but I would recommend having a login page and do the logic in your login validation code instead.

Session_End() is not guaranteed to fire. Because the web is a disconnected medium there is no way to make sure users are not logged in. What you can do, if you really need to know who is logged in, is every request a user makes you update a table indicating they are logged in. Then you can check the table for anyone who has not made a request within the last x number of minutes.


这篇关于在不使用任何类型会话的情况下,在Sql Server DataBase中保存登录和LogOut记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆