ASP. NET Get server information

Source: Internet
Author: User
Tags servervariables
Response.Write ("Server machine Name:" + server.machinename); Response.Write ("<br/>"); Response.Write ("Server IP Address:" + request.servervariables["local_addr"]); Response.Write ("<br/>"); Response.Write ("Server domain name:" + request.servervariables["SERVER_NAME"]); Response.Write ("<br/>"); Response.Write (". NET Interpretation engine version: "+". NET CLR "+ System.Environment.Version); Response.Write ("<br/>"); Response.Write ("Server OS version:" + System.Environment.OSVersion.ToString ()); Response.Write ("<br/>"); Response.Write ("Server IIS version:" + request.servervariables["Server_software"]); Response.Write ("<br/>"); Response.Write ("HTTP Access port:" + request.servervariables["Server_port"]); Response.Write ("<br/>"); Response.Write ("Absolute path to Virtual directory:" + request.servervariables["Appl_rhysical_path"]); Response.Write ("<br/>"); Response.Write ("Absolute path to execute file:" + request.servervariables["path_translated"]); Response.Write ("<br/>"); Response.Write ("Total Session:" + Session.Contents.Count.ToString ()); Response.Write ("<br/>"); Response.Write ("AppLication total: "+ Application.Contents.Count.ToString ()); Response.Write ("<br/>"); Response.Write ("Number of cache caches:" + Cache.Count.ToString ()); Response.Write ("<br/>"); Response.Write ("Server Host:" + request.servervariables["http_host"]); Response.Write ("<br/>"); Response.Write ("Server area language:" + request.servervariables["http_accept_language"]); Response.Write ("<br/>"); Response.Write ("Visitor Information:" + request.servervariables["http_user_agent"]); Response.Write ("<br/>"); Response.Write ("Number of server CPUs:" + System.Environment.GetEnvironmentVariable ("number_of_processors")); Response.Write ("<br/>"); Response.Write ("Server CPU Type:" + System.Environment.GetEnvironmentVariable ("Processor_identifier"));

You may ask Http_host and server_name that the values are the same, what is the difference between them?
The usual server default port for 80,http_host will omit the port number that is not displayed. If the server is a non-80 port, Http_host displays the port number.
Simply put: Http_host = Server_name:server_port

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    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.