string machineName = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
The reason to prefer WindowsIdentity.GetCurrent() is that this returns the account that the application is running as. This is not necessarily the account that is currently logged into Windows (think "RunAs" or impersonation/delegation). So, if you want to know the logged-in user, use the Environment (if you trust it). If you want to know the security context your application is running as, using WindowsIdentity.GetCurrent(). See
msdn.microsoft.com/en-us/library/… for more information.