Archive for October, 2006

Get the Local IP in C#

Thursday, October 5th, 2006

There are a few different ways to get the local IP address. Here’s a good article on three different methods.

Getting the Current User in C#

Thursday, October 5th, 2006

Both System.Environment.UserName and System.Security.Principal.WindowsIdentity.GetCurrent().Name return a Windows username.

What’s the difference, other than the fact that the second version returns the “full” version (domain\username)?

From the documentation:

System.Environment.UserName “gets the user name of the person who started the current thread.”

System.Security.Principal.WindowsIdentity.GetCurrent() “returns a WindowsIdentity object that represents the current Windows user.”