asp.net获取服务器基本信息的方法代码
程序员文章站
2024-03-01 17:32:04
复制代码 代码如下://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 数据绑定的实例代码
下一篇: CSS 中关于字体处理效果的思考