Click here to Skip to main content
15,888,079 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi FrNdS !!

How to create and Store Login and LogOut History details of User Logins into DATABASE.
Posted
Comments
sravani.v 16-Apr-12 2:20am    
What history(only login and logout time or else...) you want to store?

You will write code to handle it using your DAL classes. Please let us know if you run into a specific problem.
 
Share this answer
 
Presently I am only able to store Login Information by SQL Server trigger

/*
CREATE TABLE Login_Info
(
Login_Name NVARCHAR(256),
Login_Time DATETIME,
Host_Name NVARCHAR(128)
)
*/

CREATE TRIGGER Conn_Limit
ON ALL SERVER WITH EXECUTE AS 'sa'
FOR LOGON
AS
BEGIN
INSERT INTO master..Login_Info
SELECT ORIGINAL_LOGIN(), GETDATE(),
EVENTDATA().value('(/EVENT_INSTANCE/ClientHost)[1]','NVARCHAR(128)')
END
 
Share this answer
 
Just Insert current time (getdate()) in your table while logging in and logging out in your application.
 
Share this answer
 

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