How to get the hostname of the client using c#?

Asked

Viewed 532 times

4

I need to save in which machine the user performed certain action, for this I was using the following excerpt:

string maquina = Dns.GetHostName();

However, little did I know that this returns me the hostname of the server. How to get the hostname of the client?

  • What type of project are you using?

  • @Randrade ASP.NET Web Application

1 answer

2


Use the command below:

Request.UserHostName

But in some cases it doesn’t work. I don’t know if because of the browser or the network infrastructure (e.g. Load balance)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.