I have 4 servers participating in load balancing environment. The same ASP.NET application is being hosted in each server.
I would like to get the DNS Name regardless of the underlying server.
Which one of the followings will give the correct answer?
Request.Url.Host
Environment.MachineName
System.Net.Dns.GetHostName()
Thanks for your suggestion!
You could try
Request.Url.GetLeftPart(UriPartial.Authority). So for example if the request url ishttp://www.contoso.com/index.htm?date=todaythis will returnhttp://www.contoso.com.