在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Globalization; using Microsoft.Win32; using System.IO; using System.Management; using System.Diagnostics; namespace ServerInfo { /// <summary> /// Asp.net服务器探针,Power by 51aspx.com /// 作者liudao,51aspx.com版权所有 转载请保留版权信息 /// </summary> public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { /// <summary> /// 取应用程序路径 /// </summary> lbServerName.Text= "http://" + HttpContext.Current.Request.Url.Host + HttpContext.Current.Request.ApplicationPath; lbIp.Text = Request.ServerVariables["LOCAl_ADDR"]; lbDomain.Text = Request.ServerVariables["SERVER_NAME"].ToString(); lbPort.Text = Request.ServerVariables["Server_Port"].ToString(); lbIISVer.Text = Request.ServerVariables["Server_SoftWare"].ToString(); lbPhPath.Text = Request.PhysicalApplicationPath; lbOperat.Text = Environment.OSVersion.ToString(); lbSystemPath.Text = Environment.SystemDirectory.ToString(); lbTimeOut.Text = (Server.ScriptTimeout/1000).ToString() + "秒"; lbLan.Text = CultureInfo.InstalledUICulture.EnglishName; lbAspnetVer.Text = string.Concat(new object[] { Environment.Version.Major, ".", Environment.Version.Minor, Environment.Version.Build, ".", Environment.Version.Revision }); lbCurrentTime.Text = DateTime.Now.ToString(); RegistryKey key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Internet Explorer\Version Vector"); lbIEVer.Text = key.GetValue("IE", "未检测到").ToString(); lbServerLastStartToNow.Text = ((Environment.TickCount / 0x3e8)/60).ToString() + "分钟"; string[] achDrives = Directory.GetLogicalDrives(); for (int i = 0; i < Directory.GetLogicalDrives().Length - 1; i++) { lbLogicDriver.Text = lbLogicDriver.Text + achDrives[i].ToString(); } //ManagementClass diskClass = new ManagementClass("NUMBER_OF_PROCESSORS"); lbCpuNum.Text = Environment.GetEnvironmentVariable("NUMBER_OF_PROCESSORS").ToString(); lbCpuType.Text = Environment.GetEnvironmentVariable("PROCESSOR_IDENTIFIER").ToString(); lbMemory.Text = (Environment.WorkingSet / 1024).ToString()+ "M"; lbMemoryPro.Text = ((Double)GC.GetTotalMemory(false) / 1048576).ToString("N2") + "M"; lbMemoryNet.Text = ((Double)Process.GetCurrentProcess().WorkingSet64 / 1048576).ToString("N2") + "M"; lbCpuNet.Text = ((TimeSpan)Process.GetCurrentProcess().TotalProcessorTime).TotalSeconds.ToString("N0"); lbSessionNum.Text = Session.Contents.Count.ToString(); lbSession.Text = Session.Contents.SessionID; lbUser.Text = Environment.UserName; } } } } |
请发表评论