2

I have a website deployed on 3 different servers and these are using the load balancer. i want to get the real server IP Address not the load balancer. i am using the code:

HttpContext.Current.Request.ServerVariables("LOCAL_ADDR")
Sohail Hameed
  • 978
  • 2
  • 9
  • 25
  • see this might help http://stackoverflow.com/questions/3512707/how-to-get-a-host-name-behind-a-load-balancer-in-asp-net?rq=1 – Raab Jun 05 '13 at 09:35
  • @RabNawaz System.Environment.MachineName from your reference it is storing the server name not the IP. – Sohail Hameed Jun 05 '13 at 10:12

1 Answers1

0

You may try :

System.Net.IPAddress[] adds = 
                   System.Net.Dns.GetHostAddresses(System.Net.Dns.GetHostName());
jbl
  • 15,179
  • 3
  • 34
  • 101