Pages

Tuesday, November 26, 2013

Five different ways to get the computer name in ASP.NET


Dim way1 As String = System.Environment.MachineName

Dim way2 As String = Server.MachineName

 Dim way3 As String = System.Net.Dns.GetHostName

 Dim way4 As String = My.Computer.Name

Dim way5 As String = System.Net.Dns.GetHostEntry(Request.ServerVariables("remote_addr")).HostName

Dim nl As String = ""

Response.Write(way1 & nl & way2 & nl & way3 & nl & way4 & nl & way5)

No comments:

Post a Comment