Wednesday, June 24, 2009

Environment variables in C#

C# syntax:
To get the logged-in username:
string username = System.Environment.GetEnvironmentVariable("USERNAME");

To get the name of the client machine:
string machinename = Environment.MachineName;

About Us