For Programmers: Free Programming Magazines  


Home > Archive > C# > March 2004 > Can system service identify current active user?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Can system service identify current active user?
Frank Meng

2004-03-28, 10:28 pm

Hi.
Can system service identify current active user with .net?
I need current active user's logon name from system service.
I tried WindowsIdentity.GetCurrent().Name and it gave me "NT
AUTHORITY\SYSTEM" even I did logon.
Thank you for your help in advance.
Frank
Peter Venter

2004-03-28, 10:28 pm

This on a win-xp machine ?
Frank Meng

2004-03-28, 10:28 pm

"System.Environment.UserName" returned the result as "SYSTEM".
Because I logged in as "frank", I wish I could get username "frank".
I am testing it on Win2K. But I think it should be the same on WinXP.
Frank
"Champika Nirosh" <nospam@textcentric.lk> wrote in message news:<ecHuzAT8DHA.712@tk2msftngp13.phx.gbl>...[color=darkred]
> System.Environment.UserName
>
> Nirosh
>
> "Frank Meng" <mengfrank@hotmail.com> wrote in message
> news:1a370138.0402110903.417727d8@posting.google.com...
Peter Venter

2004-03-28, 10:28 pm

You can use WMI's Win32_LoggedOnUser, but this is only supported in
Win-XP and Windows 2003. Does this need to work on Win2K ?
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com