• asp.net(c#) 服务器探针


    显示结果如下:

    计算机名:http://localhost/探针
    IP地址:127.0.0.1
    域名:localhost
    端口:1435
    本文件所在路径:E:\myaspx\探针\
    操作系统:Microsoft Windows NT 5.1.2600 Service Pack 2
    操作系统所在文件夹:C:\WINDOWS\system32
    脚本超时时间:0秒系统语言:Chinese (People's Republic of China)
    .NET版本:2.050727.42
    IE版本:6.0000
    启动到现在已运行:111分钟
    逻辑驱动器:C:\D:\E:\F:\G:\H:\
    CPU 数量:2
    CPU类型:x86 Family 15 Model 6 Stepping 5, GenuineIntel
    ASP.NET所站内存:31.60M
    ASP.NET所占CPU:3%
    当前系统用户名:nan

    代码如下(可直接复制到.aspx文件中使用):

    <%@ Page Language="C#"%>
    <%@ Import Namespace="System.Globalization"%>
    <%@ Import Namespace="Microsoft.Win32" %>
    <%@ Import Namespace="System.IO"%>
    <%@ Import Namespace="System.Diagnostics" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>asp.net 探针</title>
        <style type="text/css">
        body{font:12px tahoma;line-height:28px;background:black;color:white}
        </style>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
        <%
            //代码多有参考网络,可把代码直接复制到任何页面直接使用,代码为我所用,非我所想
            Response.Write("计算机名:");
            Response.Write("http://" + HttpContext.Current.Request.Url.Host + HttpContext.Current.Request.ApplicationPath + "<br />");
            Response.Write("IP地址:");
            Response.Write(Request.ServerVariables["LOCAl_ADDR"] + "<br />");
            Response.Write("域名:");
            Response.Write(Request.ServerVariables["SERVER_NAME"].ToString() + "<br />");
            Response.Write("端口:");
            Response.Write(Request.ServerVariables["Server_Port"].ToString() + "<br />");
            Response.Write("本文件所在路径:");
            Response.Write(Request.PhysicalApplicationPath + "<br />");
            Response.Write("操作系统:");
            Response.Write(Environment.OSVersion.ToString() + "<br />");
            Response.Write("操作系统所在文件夹:");
            Response.Write(Environment.SystemDirectory.ToString() + "<br />");
            Response.Write("脚本超时时间:");
            Response.Write((Server.ScriptTimeout / 1000).ToString() + "秒" + "<br />");
            Response.Write("系统语言:");
            Response.Write(CultureInfo.InstalledUICulture.EnglishName + "<br />");
            Response.Write(".NET版本:");
            Response.Write(string.Concat(new object[] { Environment.Version.Major, ".", Environment.Version.Minor, Environment.Version.Build, ".", Environment.Version.Revision }) + "<br />");
            Response.Write("IE版本:");
            RegistryKey key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Internet Explorer\Version Vector");
            Response.Write(key.GetValue("IE", "未检测到").ToString() + "<br />");
            Response.Write("启动到现在已运行:");
            Response.Write(((Environment.TickCount / 0x3e8) / 60).ToString() + "分钟" + "<br />");
            Response.Write("逻辑驱动器:");
            string[] achDrives = Directory.GetLogicalDrives();
            for (int i = 0; i < Directory.GetLogicalDrives().Length - 1; i++)
            {
                Response.Write(achDrives[i].ToString());
            }
            Response.Write("<br />");
            Response.Write("CPU 数量:");
            Response.Write(Environment.GetEnvironmentVariable("NUMBER_OF_PROCESSORS").ToString() + "<br />");
            Response.Write("CPU类型:");
            Response.Write(Environment.GetEnvironmentVariable("PROCESSOR_IDENTIFIER").ToString() + "<br />");
            Response.Write("ASP.NET所站内存:");
            Response.Write(((Double)Process.GetCurrentProcess().WorkingSet64 / 1048576).ToString("N2") + "M" + "<br />");
            Response.Write("ASP.NET所占CPU:");
            Response.Write(((TimeSpan)Process.GetCurrentProcess().TotalProcessorTime).TotalSeconds.ToString("N0") + "%<br />");
            Response.Write("当前系统用户名:");
            Response.Write(Environment.UserName + "<br />");
        %>
        </div>
        </form>
    </body>
    </html>

  • 相关阅读:
    浅析JNI
    网易云音乐歌词下载器
    如何用一个SQL“搞挂”一个服务模块
    SpingBoot 1.5.2,MultipartFile保存图片时的不稳定异常(好像和内置tomcat有关)
    double 去除小数点后的0
    项目中时间处理----今天:时分(10:15),昨天/前天:(昨天/前天),除此之外的本周(星期几),再往前年.月.日(2017.06.15)
    SpringMvc 静态内部类 封装请求数据
    jsp页面 ajax提交数组 到struts2的action
    Struts2 s:if test判断时遇到的问题
    Struts2中 iterator隔行变色
  • 原文地址:https://www.cnblogs.com/yhb199/p/1232589.html
Copyright © 2020-2023  润新知