Solved

c#, read user session from event log

Posted on 2014-04-11
10
535 Views
Last Modified: 2014-06-03
Hi,

First, I am not sure if it is possible to get session information from event log of Windows. I am in need to read user session logs like when new user log in or log out.

Is it possible?

Thanks
0
Comment
Question by:josephm67
10 Comments
 
LVL 74

Expert Comment

by:käµfm³d 👽
ID: 39994671
What "session information" are you looking for?
0
 

Author Comment

by:josephm67
ID: 39994714
I m looking for login and log out info of users
0
 
LVL 15

Expert Comment

by:jorge_toriz
ID: 39994962
Do you want to create a new record on Windows Event Log when a user log in or log out?
0
 

Author Comment

by:josephm67
ID: 39994976
Yes, I need to grab it and then put it in database. Is it possible?
0
 
LVL 15

Assisted Solution

by:jorge_toriz
jorge_toriz earned 333 total points
ID: 39994997
Yes, you can do that, but first I need to know if you are working on a desktop application or a web application?

Meanwhile I can give you the following code:

During log in process
System.Diagnostics.EventLog.WriteEntry("YourApp", "User USERNAME logged in");
DBStoreLogIn("USERNAME");

During log out process
System.Diagnostics.EventLog.WriteEntry("YourApp", "User USERNAME logged out");
DBStoreLogOut("USERNAME");
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:josephm67
ID: 39995209
It is desktop app. But, I want to grab the event. Is it possible to grab the event.

thanks
0
 
LVL 15

Assisted Solution

by:jorge_toriz
jorge_toriz earned 333 total points
ID: 39995280
Event... what do you mean with "event"?, is there an event like "user_logged_in"? I can't depict the event you need to handle.

As far as I know you could write that pseudo-code in your authentication function, so you will be able to store the event on wherever you want.
0
 

Assisted Solution

by:josephm67
josephm67 earned 0 total points
ID: 39995341
What is authentication function?
You are talking about something else, I guess. I need to grad windows event when user log in to server or log out. Are you talking same?
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 167 total points
ID: 39995392
Are you talking about Windows user login? This info is captured in the Security node of event viewer.
0
 

Author Closing Comment

by:josephm67
ID: 40108044
thanks
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now