asp.net获取服务器基本信息的方法代码
程序员文章站
2024-02-28 22:41:16
复制代码 代码如下://server name"server name": server.machinename"server domain": request.serve...
复制代码 代码如下:
//server name
"server name": server.machinename
"server domain": request.servervariables["server_name"]
"server port": request.servervariables["server_port"]
"web server version": request.servervariables["server_software"]//path
"virtual request path": request.filepath
"physical request path": request.physicalpath
"virtual application root path": request.applicationpath
"physical application root path": request.physicalapplicationpath//platform
"operating system installation directory": environment.systemdirectory
".net version": environment.version.tostring()
".net language": system.globalization.cultureinfo.installeduiculture.englishname
"server current time": datetime.now.tostring()
"system uptime": timespan.frommilliseconds(environment.tickcount).tostring()
"script timeout": timespan.fromseconds(server.scripttimeout).tostring()
//get request headers
//eg:connection,accept,accept-charset,accept-encoding,accept-language,user-agent ...
foreach (string key in request.headers.allkeys)
{
request.headers[key];
}
//get server variables
//eg:all_http,all_raw,path_info,url ...
foreach (string key in request.servervariables.allkeys)
{
request.servervariables[key];
}
上一篇: Asp.net后台调用js 2种方法
下一篇: MYSQL跨服务器同步数据经验分享