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

ios - iPhone/iPad different view orientations in different views , and apple approval process -

monitor web browser programmatically in Android? -

c# - Using multiple datasets in RDLC -