c# - How to identify the user from windows service? -


this question has answer here:

i have developed windows service sends mail automatically when windows user logs in. want add user's name in body of mail. how can identify user, using windows service? possible? please tell me properties allowed in windows service (c#) can identify user's name.

the current user logged on system can extracted follows:

string user = system.security.principal.windowsidentity.getcurrent().name; 

here msdn reference.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -