Jim Mathew's Sharepoint Blog (MOSS Techie from Abu Dhabi)

April 15, 2009

Code Snippet: How to get client machine name?

Filed under: ASP.NET, Code Snippets, Tips & Tricks — Tags: , , — Jim Mathew @ 11:01 AM

I had a requirement to get client’s machine name   using smartpart user control in sharepoint . i have tried number of methods but unfortunately those show server name only.

here  is the code which works fine.

Dim host As  System.Net.IPHostEntry

host = System.Net.Dns.GetHostEntry(Request.ServerVariables.Item(“REMOTE_HOST”)) 

Dim strComputerName As String = host.HostName

label1.text= strComputerName

Blog at WordPress.com.