Get Computer Name in VB.net?

How to get the computer name in VB.net?
tgatifAsked:
Who is Participating?
 
LandyJConnect With a Mentor Commented:
Dim MyName As String = System.Windows.Forms.SystemInformation.ComputerName
0
 
tusharashahCommented:
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

-tushar
0
All Courses

From novice to tech pro — start learning today.