c# - How to identify the user from windows service? -
this question has answer here:
- how logged in user name window service 2 answers
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
Post a Comment