IIS Server Variables
-
SERVER_NAME "Returns the server's host name, DNS alias, or IP address as it would appear in self-referencing URLs" I have used this, and all I ever get is the host name. How do I return the IP address of the host using this option?? Have a wonderful evening Doug Wright Developer, TDCI
-
SERVER_NAME "Returns the server's host name, DNS alias, or IP address as it would appear in self-referencing URLs" I have used this, and all I ever get is the host name. How do I return the IP address of the host using this option?? Have a wonderful evening Doug Wright Developer, TDCI
-
-
SERVER_NAME "Returns the server's host name, DNS alias, or IP address as it would appear in self-referencing URLs" I have used this, and all I ever get is the host name. How do I return the IP address of the host using this option?? Have a wonderful evening Doug Wright Developer, TDCI
Hi there, With the
SERVER_NAME
variable, you only receive the IP address of the host when it appears the URL, instead you can use theLOCAL_ADDR
variable. To quickly view the values of all server variables you can simply set theTrace="True"
in thePage
directive in your web page, and launch that page in your browser then see theServer Variables
section. In addition, you can get the IP of the host in code with theDns
class defined the System.Net namespace. For more information see Dns Class[^]