用户登录时间和注销时间 [英] Users logged in time and logged out time

查看:80
本文介绍了用户登录时间和注销时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要创建一个数据库来存储登录时间和注销时间或会话超时的用户.我可以知道如何存储用户登录时间,用户登录时间或数据库超时以及数据库哪个会员登录的时间.

I need to create a database to store the users logged in time and logged out time or session timeout. May I know how do I know store the time when the users logged in or when the users had logged out or the seesion had timeout in the database as well as which member had logged in.

推荐答案

跟踪用户在您网站上的登录/注销时间 [ Logon Sentry [
Tracking users login/logout times on your site[^] should help you out.

If you are willing to try out third parties, a tool like Logon Sentry[^] could be useful to you.


string connectionString = ConfigurationManager.ConnectionStrings["TestConnectionString"].ConnectionString;
               connection = new SqlConnection(connectionString);
               connection.Open();
               //prepare sql statements
               string sql = "SELECT * from Member where member='" + member + "' And Password='" + password + "'";
               Response.Write(sql);
               SqlCommand cmd = new SqlCommand("INSERT INTO LoggedInUsers (@LoginTime)", connection);
               cmd.Parameters.Add("@LoginTime", SqlDbType.DateTime).Value = tm;
               command = new SqlCommand(sql, connection);



但是当我在登录页面上登录时,数据库没有捕获我登录的时间.



But when I sign in at the login page, the database did not capture the time that I signed in.


这篇关于用户登录时间和注销时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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