熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> .NET編程 >> 正文

asp.net獲取服務器基本信息的方法代碼

2022-06-13   來源: .NET編程 
在做網站開發的時候常常需要獲取服務器的一些基本信息怎麼獲取呢請參閱下面的簡單介紹   復制代碼 代碼如下:

  
//Server Name
"Server Name": ServerMachineName
"Server Domain": RequestServerVariables["Server_Name"]
"Server Port": RequestServerVariables["Server_Port"]
"Web Server Version": RequestServerVariables["Server_SoftWare"]//Path
"Virtual Request Path": RequestFilePath
"Physical Request Path": RequestPhysicalPath
"Virtual Application Root Path": RequestApplicationPath
"Physical Application Root Path": RequestPhysicalApplicationPath//Platform
"Operating System Installation Directory": EnvironmentSystemDirectory
"Net Version": EnvironmentVersionToString()
"Net Language": SystemGlobalizationCultureInfoInstalledUICultureEnglishName
"Server Current Time": DateTimeNowToString()
"System Uptime": TimeSpanFromMilliseconds(EnvironmentTickCount)ToString()
"Script Timeout": TimeSpanFromSeconds(ServerScriptTimeout)ToString()
//Get Request Headers
//eg:ConnectionAcceptAcceptCharsetAcceptEncodingAcceptLanguageUserAgent
foreach (string key in RequestHeadersAllKeys)
{
    RequestHeaders[key];
}
//Get Server Variables
//eg:ALL_HTTPALL_RAWPATH_INFOURL
foreach (string key in RequestServerVariablesAllKeys)
 {
          RequestServerVariables[key];
 }


From:http://tw.wingwit.com/Article/program/net/201311/14250.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.