asp.net 擷取伺服器資訊

來源:互聯網
上載者:User
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

  • 相關文章

    聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.