> Try System.Threading.CurrentPrincipal.Identity.Name. By default Thread.CurrentPrincipal.Identity.Name that will just return an empty string, unless you have previously set Thread.CurrentPrincipal to a WindowsPrincipal.
The previous response is right: use WindowsIdentity.GetCurrent().Name;
How to get the Windows Username/login
Ernst Kuschke
> Try System.Threading.CurrentPrincipal.Identity.Name.
By default Thread.CurrentPrincipal.Identity.Name that will just return an empty string, unless you have previously set Thread.CurrentPrincipal to a WindowsPrincipal.
The previous response is right: use WindowsIdentity.GetCurrent().Name;
JBinGA
Bruce Johnson [C# MVP]
http://www.objectsharp.com/blogs/bruce
Dorkboy
Hi,
I just got the solution from:
System.Security.Principal.WindowsIdentity.GetCurrent().Name;
I guess I can work from there :)
cheers