Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# .NET WCF
I've been searching on google, codeplex, codeproject, stackoverflow, dream.in.code... nothing seems to be coming up.
 
My final result for this project is to have a service that is running in a computer lab. As soon as a user logs on, the service running will send the user information, the computer name and a 'logged in' bool to a server. The server is only keeping the 'logged in' status for that computer name, but using the user information to see if it has any messages for that category of user. Then, when the user logs off, the service sends the computer name and a 'logged off' bool to the server.
 
I don't have a lot of experience with WCF or coding for Windows events, so I'm lost when it comes to getting a part of the service to trigger with a user logon/logoff.
 
I can get all the information that I need if I use a windows form and trigger the data collection with a button click, but that doesn't help when using it as a wcf.
 
So, does anyone have any advice as to how to get the method to run when the user logs in or logs out? Thanks in advance! This hunt for a needle in a haystack is making my head spin Smile | :)
Posted 26-Dec-11 5:08am

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Write a Windows service that lives on the server. All it does is listen for client connections. When it receives one, it sends back any data for that user that is pending.
 
Write a SECOND windows service that lives on a given client's machine. This service will notify the server that the user logged in, and will receive the data that the server sends back (if any), and stores it in a local data file.
 
Write a system tray application that talks to the local client service and displays notifications received from the server.
 
Go forth, and code.
  Permalink  
Comments
AngieLeigh at 26-Dec-11 10:17am
   
Thanks for the quick reply! I already have those set up :-)
What I'm stuck on is getting the local client service to tell the server that the user has logged in. I know there has to be some simple way to do it, but like always, I love over complicating things and then the blonde hair kicks in and I get confused haha ;-)
John Simmons / outlaw programmer at 26-Dec-11 12:38pm
   
You want to capture the Logon/Logoff WMI Win32_LogonSession events.
AngieLeigh at 27-Dec-11 8:36am
   
Thanks John! :-)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web03 | 2.8.1411022.1 | Last Updated 26 Dec 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100