zoukankan      html  css  js  c++  java
  • ASP.NET 服务器参数、路径等

    using System;
    using System.Globalization;
    using System.Web.UI;
    
    namespace WebApplication1
    {
        public partial class _Default : Page
        {
            protected void Page_Load(object sender, EventArgs e)
            {
                string test = "";
                test += "Request.ServerVariables[\"LOCAL_ADDR\"]:" + Request.ServerVariables["LOCAL_ADDR"] + "<br/>"; //服务器IP地址
                test += "Request.ServerVariables[\"SERVER_NAME\"]:" + Request.ServerVariables["SERVER_NAME"] + "<br/>"; //服务器域名 
                test += "Request.ServerVariables[\"SERVER_SOFTWARE\"]:" + Request.ServerVariables["SERVER_SOFTWARE"] + "<br/>"; //服务器IIS版本
                test += "Request.ServerVariables[\"SERVER_PORT\"]:" + Request.ServerVariables["SERVER_PORT"] + "<br/>"; //HTTP访问端口
                test += "Request.ServerVariables[\"APPL_RHYSICAL_PATH\"]:" + Request.ServerVariables["APPL_RHYSICAL_PATH"] + "<br/>"; //虚拟目录的绝对路径
                test += "Request.ServerVariables[\"PATH_TRANSLATED\"] :" + Request.ServerVariables["PATH_TRANSLATED"] + "<br/>"; //执行文件的绝对路径
                test += "Request.ServerVariables[\"HTTP_HOST\"]:" + Request.ServerVariables["HTTP_HOST"] + "<br/>"; //域名主机
                test += "Request.ServerVariables[\"HTTP_ACCEPT_LANGUAGE\"]:" + Request.ServerVariables["HTTP_ACCEPT_LANGUAGE"] + "<br/>"; //服务器区域语言
                test += "Request.ServerVariables[\"HTTP_USER_AGENT\"]:" + Request.ServerVariables["HTTP_USER_AGENT"] + "<br/>";
    
                test += "<br/>";
    
                test += "Request.ApplicationPath: " + Request.ApplicationPath + "<br/>";
                test += "Request.CurrentExecutionFilePath:" + Request.CurrentExecutionFilePath + "<br/>";
                test += "Request.FilePath:" + Request.FilePath + "<br/>";
                test += "Request.Path:" + Request.Path + "<br/>";
                test += "Request.PhysicalApplicationPath:" + Request.PhysicalApplicationPath + "<br/>";
                test += "Request.RawUrl:" + Request.PhysicalApplicationPath + "<br/>";
                test += "Request.Url.AbsolutePath: " + Request.PhysicalApplicationPath + "<br/>";
                test += "Request.Url.AbsoluteUri:" + Request.PhysicalApplicationPath + "<br/>";
                test += "Request.Url.Host:" + Request.PhysicalApplicationPath + "<br/>";
                test += "Request.Url.LocalPath:" + Request.PhysicalApplicationPath + "<br/>";
                test += "Request.Url.LocalPath:" + Request.PhysicalApplicationPath + "<br/>";
    
                test += "<br/>";
    
                test += "服务器名称:" + Server.MachineName + "<br/>"; //服务器名称
                test += "CPU个数:" + Environment.GetEnvironmentVariable("NUMBER_OF_PROCESSORS") + "<br/>"; //CPU个数
                test += "CPU类型:" + Environment.GetEnvironmentVariable("PROCESSOR_IDENTIFIER") + "<br/>"; //CPU类型
                test += "虚拟目录Session总数:" + Session.Contents.Count.ToString(CultureInfo.InvariantCulture) + "<br/>"; //虚拟目录Session总数
                test += "虚拟目录Application总数:" + Application.Contents.Count.ToString(CultureInfo.InvariantCulture) + "<br/>";//虚拟目录Application总数         
                test += ".NET解释引擎版本:" + ".NET CLR" + Environment.Version.Major + "." + Environment.Version.Minor + "." + Environment.Version.Build + "." + Environment.Version.Revision + "<br/>"; //.NET解释引擎版本
                test += "服务器操作系统版本:" + Environment.OSVersion + "<br/>"; //服务器操作系统版本
    
    
    
                Response.Write(test);
            }
        }
    }

    输出结果:


  • 相关阅读:
    线程进程之间的关系
    socket网络编程
    Docker在github上的站点
    大型网站架构体系的演变
    centos7 安装SSH
    如何在CentOS 7中禁用IPv6
    在 Docker 上运行一个 RESTful 风格的微服务
    docker 操作命令详解
    玩转Docker镜像
    搭建自己的 Docker 私有仓库服务
  • 原文地址:https://www.cnblogs.com/zhangqs008/p/3618449.html
Copyright © 2011-2022 走看看