I have an ASP.NET 3.5 application that uses ASP.NET forms authentication. I want to be able to get the Windows user name currently logged into the computer (NOT logged into
To get the currently logged-in user to Windows in C#, use:
string Username = System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString();