[DllImport("kernel32")]
public static extern void GlobalMemoryStatus(ref MEMORY_INFO meminfo); [StructLayout(LayoutKind.Sequential)] public struct MEMORY_INFO { public uint dwLength; public uint dwMemoryLoad; public uint dwTotalPhys; public uint dwAvailPhys; public uint dwTotalPageFile; public uint dwAvailPageFile; public uint dwTotalVirtual; public uint dwAvailVirtual; } protected string MemberName, AdminLevel, MemoryLoad, TotalPhys, AvailPhys, TotalPageFile, AvailPageFile, TotalVirtual; protected string ServerOS, CpuSum, CpuType, MachineName, ServerName, ServerPath, ServerNet, ServerArea, ServerTimeOut, ServerStart, UsersTxt; protected string PrStart, AspNetN, AspNetCpu, ServerSessions, ServerApp, ServerCache, ServerAppN, ServerFso, RunTime, SessionTime, VersionTxt; protected string SiteTitle, SiteUrl; protected void Page_Load(object sender, EventArgs e) {this.CheckPower();
if (this.adminer != null)
{ DataLoad(); } } private void DataLoad() { DateTime sTime = DateTime.Now;MemberName = "";
ServerOS = Environment.OSVersion.ToString();
CpuSum = Environment.GetEnvironmentVariable("NUMBER_OF_PROCESSORS"); CpuType = Environment.GetEnvironmentVariable("PROCESSOR_IDENTIFIER"); MachineName = Server.MachineName; ServerName = Request.ServerVariables["SERVER_NAME"]; ServerPath = Request.ServerVariables["APPL_PHYSICAL_PATH"]; ServerNet = ".NET CLR " + Environment.Version.ToString(); ServerArea = (DateTime.Now - DateTime.UtcNow).TotalHours > 0 ? "+" + (DateTime.Now - DateTime.UtcNow).TotalHours.ToString() : (DateTime.Now - DateTime.UtcNow).TotalHours.ToString(); ServerTimeOut = Server.ScriptTimeout.ToString(); ServerStart = ((Double)System.Environment.TickCount / 3600000).ToString("N2"); PrStart = GetPrStart(); AspNetN = GetAspNetN(); AspNetCpu = GetAspNetCpu(); ServerSessions = Session.Contents.Count.ToString(); ServerApp = Application.Contents.Count.ToString(); ServerCache = Cache.Count.ToString(); ServerAppN = GetServerAppN(); ServerFso = Check("Scripting.FileSystemObject"); ServerTimeOut = Server.ScriptTimeout.ToString() + "毫秒";SessionTime = HttpContext.Current.Session.Timeout.ToString();
MEMORY_INFO MemInfo; MemInfo = new MEMORY_INFO(); GlobalMemoryStatus(ref MemInfo); MemoryLoad = MemInfo.dwMemoryLoad + " %"; TotalPhys = dFileSize(MemInfo.dwTotalPhys); AvailPhys = dFileSize(MemInfo.dwAvailPhys); TotalPageFile = dFileSize(MemInfo.dwTotalPageFile); AvailPageFile = dFileSize(MemInfo.dwAvailPageFile); TotalVirtual = dFileSize(MemInfo.dwTotalVirtual);}