0

Is it possible to find what the Web Server's name is when the host header is set to something else in an asp.net web app? Environment is a company intranet, Windows 2003 server (IIS 6).

e.g. the host header may be set to myApp.company.com and the servers name might be webAppServer1.company.com or webAppServer2.company.com

Using the Server Variable "SERVER_NAME" just returns the host header...

Thanks heaps!

pavium
  • 14,808
  • 4
  • 33
  • 50
davidsleeps
  • 9,393
  • 11
  • 59
  • 73

3 Answers3

0

Yet another option is using: Server.MachineName

Cesar
  • 2,229
  • 1
  • 22
  • 20
0

Try:

string host = Environment.MachineName;
Wim
  • 11,998
  • 1
  • 34
  • 57
0

Also, this I presume accesses the same information as Wim Hollebrandse's suggestion:

My.Computer.Name
davidsleeps
  • 9,393
  • 11
  • 59
  • 73
  • Yep. It's exactly the same. The Computer object lives in Microsoft.VisualBasic.Devices and inherits from ServerComputer which implements it's Name getter property by returning Environment.MachineName. – Wim Nov 09 '09 at 08:17