Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 639
  • Last Modified:

c#, read user session from event log

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
josephm67
Asked:
josephm67
4 Solutions
 
käµfm³d 👽Commented:
What "session information" are you looking for?
0
 
josephm67Author Commented:
I m looking for login and log out info of users
0
 
jorge_torizResearch & Development ManagerCommented:
Do you want to create a new record on Windows Event Log when a user log in or log out?
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
josephm67Author Commented:
Yes, I need to grab it and then put it in database. Is it possible?
0
 
jorge_torizResearch & Development ManagerCommented:
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
 
josephm67Author Commented:
It is desktop app. But, I want to grab the event. Is it possible to grab the event.

thanks
0
 
jorge_torizResearch & Development ManagerCommented:
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
 
josephm67Author Commented:
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
 
CodeCruiserCommented:
Are you talking about Windows user login? This info is captured in the Security node of event viewer.
0
 
josephm67Author Commented:
thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now