Get Computer Name in

How to get the computer name in
Who is Participating?
LandyJConnect With a Mentor Commented:
Dim MyName As String = System.Windows.Forms.SystemInformation.ComputerName
If you just need Name of the Currently logged on user there are few easy option like following:
- Environment.UserName
- environment variable |USERNAME| using the Environment.GetEnvironmentVariable method
- SystemInformation.UserName


And if it it's a ASP.Net application then do following to get the UserName
  - Disable Annonymous Access (from IIS)
  - Turn on Windows Authentication (in Web.Config)  (<authentication mode="Windows" />)
  - Use 'User.Identity.Name' or Request.ServerVariables("LOGON_USER") or Request.ServerVariables("REMOTE_USER") to retrive Username

All Courses

From novice to tech pro — start learning today.