Click here to Skip to main content
15,886,729 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
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.
Posted
Comments
Sergey Alexandrovich Kryukov 29-Oct-11 22:06pm    
Not clear what's the problem? Getting time, presentation of time data, using database, what?
What did you try?
--SA

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.
 
Share this answer
 
Comments
Amir Mahfoozi 30-Oct-11 2:52am    
+5
Abhinav S 30-Oct-11 3:47am    
Thanks.
C#
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.
 
Share this answer
 
Comments
RaisKazi 30-Oct-11 2:03am    
If these are more details about your Question, Then request you to move it to your Question-Section using link "Improve question".

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900