Getting a machine name of logged in user in


I recently encountered this scenario and thought of blogging about it. To get the machine name of the logged in user, you can use the “GetHostEntry()” method provided in System.Net.Dns class.

GetHostEntry takes a string as parameter and it is the hostname or address of the machine whose entry we need to get. So in order to get the machine name, we need to make use of the server variable remote_addr.

GetHostEntry returns an IPHostEntry object and its HostName property would give the machine name of the logged in user. So the line of code would be



Hope this helps!

This entry was posted in .NET, ASP.NET and tagged , , , , , , , , , , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *