獲取伺服器資訊
#region 獲取伺服器及使用者資訊
private void DataLoad()
{
DateTime sTime = DateTime.Now;
ServerOS = Environment.OSVersion.ToString(); //作業系統:
CpuSum = Environment.GetEnvironmentVariable("NUMBER_OF_PROCESSORS"); //CPU個數:
CpuType = Environment.GetEnvironmentVariable("PROCESSOR_IDENTIFIER"); //CPU型別:
ServerSoft = Request.ServerVariables["SERVER_SOFTWARE"]; //資訊服務軟體:
MachineName = Server.MachineName; //伺服器名
ServerName = Request.ServerVariables["SERVER_NAME"]; //伺服器域名
ServerPath = Request.ServerVariables["APPL_PHYSICAL_PATH"]; //虛擬服務絕對路徑
ServerNet = ".NET CLR " + Environment.Version.ToString(); //DotNET 版本
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(); //AspNet 記憶體佔用
AspNetCpu = GetAspNetCpu(); //AspNet CPU時間
ServerSessions = Session.Contents.Count.ToString(); //Session總數
ServerApp = Application.Contents.Count.ToString(); //Application總數
ServerCache = Cache.Count.ToString(); //應用程式快取總數
ServerAppN = GetServerAppN(); //應用程式佔用記憶體
ServerFso = Check("Scripting.FileSystemObject"); //FSO 文字檔案讀寫
ServerTimeOut = Server.ScriptTimeout.ToString() + "毫秒"; //本頁執行時間
if (ServerSoft == "")
{
ServerSoft = "無";
}