ASP.NET aspx获取服务器信息, 操作系统, .NET版本, IIS版本

新建WebApplication, 在aspx页面中写入如下代码
<%@ Page Language="C#" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
</head>
<body>

    <%
        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 " + Environment.Version);
        Response.Write("<br/>");
        Response.Write("服务器操作系统版本:" + 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"));
        Response.Write("<br/>");
    %>
</body>
</html>

作者最新文章
Winform TextBox (文本框) 密码输入框, 输入内容显示*号 (星号)
Winform 启动前弹出登录界面, 登录成功之后再显示主界面
C# 字符串string和字符数组char[]的相互转换
C# 字符串倒序输出, 实现字符串倒序的方法
Winform 如何从 TextBox(文本框) 控件读取每一行数据到数组