系統探針(如圖)
阿新 • • 發佈:2018-06-09
ted tick RR 服務器名稱 java art public pre png
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"View Coderel="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() + "\n小時"; 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(); } } }View Code
系統探針(如圖)