Response.Write("伺服器機器名:" + Server.MachineName);Response.Write("<br/>");Response.Write("伺服器IP地址:" + Request.ServerVariables["LOCAL_ADDR"]);Response.Write("<br/>");Response.Write("伺服器網域名稱:" + Request.ServerVariables["SERVER_NAME"]);Response.Write("<br/>");Response.Write(".NET解釋引擎版本:" + ".NET CLR" + System.Environment.Version);Response.Write("<br/>");Response.Write("伺服器作業系統版本:" + System.Environment.OSVersion.ToString());Response.Write("<br/>");Response.Write("伺服器IIS版本:" + Request.ServerVariables["SERVER_SOFTWARE"]);Response.Write("<br/>");Response.Write("HTTP訪問連接埠:" + Request.ServerVariables["SERVER_PORT"]);Response.Write("<br/>");Response.Write("虛擬目錄的絕對路徑:" + Request.ServerVariables["APPL_RHYSICAL_PATH"]);Response.Write("<br/>");Response.Write("執行檔案的絕對路徑:" + Request.ServerVariables["PATH_TRANSLATED"]);Response.Write("<br/>");Response.Write("Session總數:" + Session.Contents.Count.ToString());Response.Write("<br/>");Response.Write("Application總數:" + Application.Contents.Count.ToString());Response.Write("<br/>");Response.Write("緩衝Cache總數:" + Cache.Count.ToString());Response.Write("<br/>");Response.Write("伺服器主機:" + Request.ServerVariables["HTTP_HOST"]);Response.Write("<br/>");Response.Write("伺服器地區語言:" + Request.ServerVariables["HTTP_ACCEPT_LANGUAGE"]);Response.Write("<br/>");Response.Write("訪客資訊:" + Request.ServerVariables["HTTP_USER_AGENT"]);Response.Write("<br/>");Response.Write("伺服器CPU個數:" + System.Environment.GetEnvironmentVariable("NUMBER_OF_PROCESSORS"));Response.Write("<br/>");Response.Write("伺服器CPU類型:" + System.Environment.GetEnvironmentVariable("PROCESSOR_IDENTIFIER"));
你也許會問 HTTP_HOST 和 SERVER_NAME 的值是一樣的,它們之間有什麼區別?
通常伺服器預設連接埠為80,HTTP_HOST將省略不顯示連接埠號碼。如果伺服器是非80連接埠,則HTTP_HOST顯示連接埠號碼。
簡單的說就是: HTTP_HOST = SERVER_NAME:SERVER_PORT