Five Different Ways to Get the Username in C#

Here are five different ways to get the domain and username in C#. Make sure to include System.Management, System.Security.Principal, and System.Runtime.InteropServices namespaces. Credit for Method#4 goes to Ben Reichelt and for method#5 to Nick Parker.



About soumya chattopadhyay
I live and work in Seattle, WA. I work with Microsoft technologies, and I'm especially interested in C#.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: