Jose Saiz

Jose Saiz

  • 1.5k
  • 260
  • 102.7k

Help getting the remote computer name

Feb 28 2019 5:05 PM
Hi guys, I am in big time need of solve the problem I am currently having trying to get the remote client computer name, I have tried the following
1st option
Request.UserHostName.Trim() works good within the Visual Studio IDE but it is deployed to Windows 2016 IIS8 hosting I get the Public IP instead.
2nd Option
I also tried the following which also works within the visual Studio IDE but after deployed
I get an error message "no host found"
string[] computer_name = System.Net.Dns.GetHostEntry(Request.ServerVariables["REMOTE_ADDR"]).HostName.Split(new Char[] { '.' });
String ecname = System.Environment.MachineName;
return computer_name[0].ToString();
3rd Option
I also tried the following which also works within the visual Studio IDE but after deployed
I get the server name instead
System.Net.Dns.GetHostEntry(Dns.GetHostName()).HostName.ToString()
Any Idea How to get the remote client computer name with ASP.NET C# Framework 4.0
without using ActiveX
I will really appriciate the right and working answer.
TIA

Answers (2)