Monday, April 25, 2005

get server name

When using "C:\WINDOWS\system32\drivers\etc" to edit host file, sometimes developers get confused what physical server they are browsering.

probably you need a server file in your web application, and that file should show which server you are on.

use "System.Environment.MachineName" instead of Request.URL.Server or anything else, because those request variable will not indicate the real server.

code snapit:

System.Environment.MachineName + " - " + Request.ServerVariables["LOCAL_ADDR"]

No comments: