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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top