Solved

c#, read user session from event log

Posted on 2014-04-11
10
555 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 75

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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 

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
 

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

808 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