1.

How To Get The Hostname Or Ip Address Of The Server?

Answer»

You can use EITHER of these:

  • HttpContext.Current.Server.MachineName
  • HttpContext.Current.Request.ServerVariables["LOCAL_ADDR"]

The first one should RETURN the name of the MACHINE, the second returns the local ip address.

Note: that name of the machine could be different than HOST, since your site could be using host headers.

You can use either of these:

The first one should return the name of the machine, the second returns the local ip address.

Note: that name of the machine could be different than host, since your site could be using host headers.



Discussion

No Comment Found