is there a function in C# similar to GetComputerName

  • Thread starter Thread starter WLi
  • Start date Start date
W

WLi

How can I catch the username and NT machine's name right after I run
an Visual C# application. Before I used GetComputerName and
GetUserName to obtain those inforamtion.
Thanks.
 
WLi said:
How can I catch the username and NT machine's name right after I run
an Visual C# application. Before I used GetComputerName and
GetUserName to obtain those inforamtion.
Thanks.

The System.Windows.Forms namespace has a SystemInformation object with
this information (ComputerName and UserName).

Additionally, you can use System.Net.Dns.GetHostName() to look up the
local machine's DNS name, which usually -- but not always -- matches
it's Windows networking name.

--Mike
 
How can I catch the username and NT machine's name right after I run
an Visual C# application. Before I used GetComputerName and
GetUserName to obtain those inforamtion.

In addition to the possibilities Mike listed you can also use the static
members in the System.Environment.UserName and MachineName.

Cheers

Arne Janning
 
Back
Top