系统探针(如图)
Posted zeng-qh
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了系统探针(如图)相关的知识,希望对你有一定的参考价值。
1 <%@ Page Language="C#" AutoEventWireup="true" EnableViewState="false" CodeFile="admin_Main.aspx.cs" Inherits="admin_Main" %> 2 3 <html xmlns="http://www.w3.org/1999/xhtml"> 4 <head id="Head1" runat="server"> 5 <title></title> 6 <link href="menu/Css.css" rel="stylesheet" type="text/css" /> 7 <script src="menu/JStime.js" type="text/javascript"></script> 8 </head> 9 <body> 10 <form id="form1" runat="server"> 11 <div> 12 13 <table width="780" align="center" cellspacing="0"> 14 <tr> 15 <td class="lanyuss" align="center" colspan="2"> 16 系统探针</td> 17 </tr> 18 <tr> 19 <td class="lanyuds" width="30%" align="left"> 管理员名称:</td> 20 <td class="lanyuds" align="left"> <asp:Label ID="Label1" ForeColor="red" runat="server" /></td> 21 </tr> 22 <tr> 23 <td class="lanyuds" align="left"> 服务器名称:</td> 24 <td class="lanyuds"align="left"> <asp:Label ID="ComName" runat="server"></asp:Label></td> 25 </tr> 26 <tr>+ 27 <td class="lanyuds" align="left"> 服务器IP地址:</td> 28 <td class="lanyuds"align="left"> <asp:Label ID="IP" runat="server"></asp:Label></td> 29 </tr> 30 <tr> 31 <td class="lanyuds" align="left"> 服务器域名:</td> 32 <td class="lanyuds"align="left"> <asp:Label ID="Web" runat="server"></asp:Label></td> 33 </tr> 34 <tr> 35 <td class="lanyuds" align="left"> 服务器端口:</td> 36 <td class="lanyuds"align="left"> <asp:Label ID="Dk" runat="server"></asp:Label></td> 37 </tr> 38 <tr> 39 <td class="lanyuds" align="left"> 服务器IIS版本:</td> 40 <td class="lanyuds"align="left"> <asp:Label ID="Iis" runat="server"></asp:Label></td> 41 </tr> 42 <tr> 43 <td class="lanyuds" align="left"> 程序所在目录:</td> 44 <td class="lanyuds"align="left"> <asp:Label ID="Path" runat="server"></asp:Label></td> 45 </tr> 46 <tr> 47 <td class="lanyuds" align="left"> 服务器操作系统:</td> 48 <td class="lanyuds"align="left"> <asp:Label ID="Os" runat="server"></asp:Label></td> 49 </tr> 50 <tr> 51 <td class="lanyuds" align="left"> 服务器脚本超时:</td> 52 <td class="lanyuds"align="left"> <asp:Label ID="TimeOut" runat="server"></asp:Label></td> 53 </tr> 54 <tr> 55 <td class="lanyuds" align="left"> .NET Framework 版本:</td> 56 <td class="lanyuds"align="left"> <asp:Label ID="Framework" runat="server"></asp:Label></td> 57 </tr> 58 <tr> 59 <td class="lanyuds" align="left"> 服务器当前时间:</td> 60 <td class="lanyuds"align="left"> <asp:Label ID="Time" ForeColor="red" runat="server"></asp:Label> <span id="timePlace" style="color:Red"></span></td> 61 </tr> 62 <tr> 63 <td class="lanyuds" align="left"> 服务器已运行时间:</td> 64 <td class="lanyuds"align="left"> <asp:Label ID="StartTime" ForeColor="red" runat="server"></asp:Label></td> 65 </tr> 66 <tr> 67 <td class="lanyuds" align="left"> Asp.net所占内存:</td> 68 <td class="lanyuds"align="left"> <asp:Label ID="w3w" ForeColor="red" runat="server"></asp:Label></td> 69 </tr> 70 <tr> 71 <td class="lanyuds" align="left"> 逻辑驱动器数:</td> 72 <td class="lanyuds"align="left"> <asp:Label ID="IDE" runat="server"></asp:Label></td> 73 </tr> 74 <tr> 75 <td class="lanyuds" align="left"> 当前Session数量:</td> 76 <td class="lanyuds"align="left"> <asp:Label ID="SessionNum" runat="server"></asp:Label></td> 77 </tr> 78 <tr> 79 <td class="lanyuds" align="left"> CPU总数:</td> 80 <td class="lanyuds"align="left"> <asp:Label ID="CpuNum" runat="server" Text="Label"></asp:Label></td> 81 </tr> 82 <tr> 83 <td class="lanyuds" align="left"> CPU类型:</td> 84 <td class="lanyuds"align="left"> <asp:Label ID="CpuType" runat="server" Text="Label"></asp:Label></td> 85 </tr> 86 </table> 87 88 </div> 89 </form> 90 91 </body> 92 </html>
后端:
using System.IO;
using System.Diagnostics;//空间命名
//后端 using System; using System.Collections; using System.Configuration; using System.Data; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.IO; using System.Diagnostics; public partial class admin_Main : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Telesa.IsAdmin(); if (Session["Admin"] != null) { Label1.Text = Session["Admin"].ToString(); } else { Label1.Visible = false; } ComName.Text = Server.MachineName; IP.Text = Request.ServerVariables["Local_addr"]; Web.Text = Request.ServerVariables["server_name"].ToString(); Dk.Text = Request.ServerVariables["server_port"].ToString(); Iis.Text = Request.ServerVariables["server_software"].ToString(); Path.Text = Request.PhysicalApplicationPath; Os.Text = Environment.OSVersion.ToString(); TimeOut.Text = (Server.ScriptTimeout / 1000).ToString() + "秒"; Framework.Text = string.Concat(new object[] { Environment.Version.Major, ".", Environment.Version.Minor, ".", Environment.Version.Build, ".", Environment.Version.Revision }); Time.Text = DateTime.Now.ToString("yyyy-MM-dd"); StartTime.Text = (((Environment.TickCount / 0x3e8) / 60) / 60).ToString() + " 小时"; string[] achDrives = Directory.GetLogicalDrives(); for (int i = 0; i < Directory.GetLogicalDrives().Length; i++) { IDE.Text = IDE.Text + achDrives[i].ToString(); } w3w.Text = ((Double)Process.GetCurrentProcess().WorkingSet64 / 1048576).ToString("N2") + "M"; CpuNum.Text = Environment.GetEnvironmentVariable("NUMBER_OF_PROCESSORS").ToString(); CpuType.Text = Environment.GetEnvironmentVariable("PROCESSOR_IDENTIFIER").ToString(); SessionNum.Text = Session.Contents.Count.ToString(); } } }
以上是关于系统探针(如图)的主要内容,如果未能解决你的问题,请参考以下文章