首页
技术库|站长工具|技术手册|字体库|知识点词汇表| 联系我们|
打开本页的html静态页面
 

主菜单

文章分类

.: Asp技术 .: Asp代码库 .: Asp常用通用函数之返回服务器信息

  • 全文内容
  • 发表评论
  • 文章点评
  • 文章附件
  • Email文章
  • 打印文章

Asp常用通用函数之返回服务器信息

点击次数:260 创建日期:11-25-2007 录入:cn-web.com 字体:[ ] 点评:


 '函数名:GetServerInfo
  '作 用:返回服务器信息
  '参 数:Lx ---- 返回信息代码类
  ' 0 : 服务器的域名
  ' 1 : 服务器的IP地址
  ' 2 : 服务器操作系统
  ' 3 : 服务器解译引擎
  ' 4 : 服务器软件的名称及版本
  ' 5 : 服务器正在运行的端口
  ' 6 : 服务器CPU数量
  ' 7 : 服务器Application数量
  ' 8 : 服务器Session数量
  ' 9 : 请求的物理路径
  '10 : 请求的URL
  '11 : 服务器当前时间
  '12 : 脚本连接超时时间
  '13 : 服务器CPU详情
  '14 :
  '返回值:返回信息字串
  '示 例:GetServerInfo(2)
  '**************************************************
  Public Function GetServerInfo(ByVal Lx)
   GetServerInfo=""
   Dim okCPUS, okCPU, okOS
   on error resume next
   Set WshShell = server.CreateObject("WScript.Shell")
   Set WshSysEnv = WshShell.Environment("SYSTEM")
   okOS = cstr(WshSysEnv("OS"))
   okCPUS = cstr(WshSysEnv("NUMBER_OF_PROCESSORS"))
   okCPU = cstr(WshSysEnv("PROCESSOR_IDENTIFIER"))
   if isnull(okCPUS) & "" = "" then
   okCPUS = Request.ServerVariables("NUMBER_OF_PROCESSORS")
   end if
   tnow = now():oknow = cstr(tnow)
   if oknow <> year(tnow) & "-" & month(tnow) & "-" & day(tnow) & " " & hour(tnow) & ":" & right(FormatNumber(minute(tnow)/100,2),2) & ":" & right(FormatNumber(second(tnow)/100,2),2) then oknow = oknow & " (日期格式不规范)"
   If Lx=0 Then GetServerInfo=Request.ServerVariables("server_name")
   If Lx=1 Then GetServerInfo=Request.ServerVariables("LOCAL_ADDR")
   If Lx=2 Then GetServerInfo=okOS '' Request.ServerVariables("OS")
   If Lx=3 Then GetServerInfo=ScriptEngine & "/"& ScriptEngineMajorVersion &"."&ScriptEngineMinorVersion&"."& ScriptEngineBuildVersion
   If Lx=4 Then GetServerInfo=Request.ServerVariables("SERVER_SOFTWARE")
   If Lx=5 Then GetServerInfo=Request.ServerVariables("server_port")
   If Lx=6 Then GetServerInfo=okCPUS '' Request.ServerVariables("NUMBER_OF_PROCESSORS")
   If Lx=7 Then GetServerInfo=Application.Contents.Count
   If Lx=8 Then GetServerInfo=Session.Contents.Count
   If Lx=9 Then GetServerInfo=Request.ServerVariables("path_translated")
   If Lx=10 Then GetServerInfo=Request.ServerVariables("server_name")&Request.ServerVariables("script_name")
   If Lx=11 Then GetServerInfo=oknow
   If Lx=12 Then GetServerInfo=Server.ScriptTimeout
   If Lx=13 Then GetServerInfo=okCPU
  End Function

请文明参与讨论,禁止漫骂攻击。
评论总数:0 [ 查看全部 ] 网友评论
此文章还没有任何评论!
(+5分)
(+4分)
(+3分)
(+2分)
(+1分)
此内容无附件
网站地图 - 知识词汇 - 全文检索 - 广告服务 - 帮助中心 - 联系我们
.:www.cn-web.com
网站技术开发联盟之WEB开发技术知识库
联系人:老韩(QQ:5679551)
晋ICP备07003487号