Solved

c#, read user session from event log

Posted on 2014-04-11
10
562 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

 

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

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Amazon S3 .Net error 5 40
How to force output to ascii 2 37
vb.net datagrid scroll automatically to the first found row 11 28
Broken .resx file generating errors 18 18
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

749 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