L
Lau Lei Cheong
Hello,
I'm writing a .NET v1.1 Windows Application which will try to determine
current username by Environment.UserDomainName + "\\" +
Environment.UserName. This approach works in normal condition if I run it
directly. (returns "<DomainName>\<Username>")
But if I use the program with RunAs.exe, let's say run with
"<DomainName>\Administrator" account, it'll return
"<MachineName>\administrator" instead.
Can anyone suggest what I should use to determine the current username?
Regards,
Lau Lei Cheong
I'm writing a .NET v1.1 Windows Application which will try to determine
current username by Environment.UserDomainName + "\\" +
Environment.UserName. This approach works in normal condition if I run it
directly. (returns "<DomainName>\<Username>")
But if I use the program with RunAs.exe, let's say run with
"<DomainName>\Administrator" account, it'll return
"<MachineName>\administrator" instead.
Can anyone suggest what I should use to determine the current username?
Regards,
Lau Lei Cheong