Get Client Host name on Azure ASP App

2k Views Asked by At

Trying to get the local machine name for an Azure hosted ASP application.

Request.ServerVariables["HOST_NAME"] 

returns 127.0.0.1 as does HOST_ADDRESS

In fact I can't find anything in Request.Server variables that reflects the local hostname.

Dns.GetHostEntry(Request.UserHostAddress).HostName 

will not work as this is a server side lookup, so all you get is the public gateway name not the actual end-user machine name.

Any ideas?

I am stumped and just feel this should be so simple!??!

1

There are 1 best solutions below

0
On

As you're potentially behind a load balancer when you deploy to azure try using

Request.ServerVariables["REMOTE_ADDR"]