动网论坛,站长建站首选,国内使用量最多的论坛软件 动网论坛官方技术讨论区 站长工具 申请属于您自己的免费论坛
首页 | 新闻资讯 | 网站运营 | 网络编程 | 数据库 | 服务器 | 网页设计 | 图像媒体 | 网络应用 | 搜索优化 | 资源下载 | 动网主机
    本站内  互联网 ASP论坛  ASP.Net论坛  PHP论坛
   Asp → 阅读文章

 检测已经安装的服务器组件

作者来源: 
阅读 2590 人次 , 2006-2-16 14:27:00 

此功能来自一个DWMX插件,剥离代码后可以根据需要进行扩展.

<% '定义检测内容数组
Dim theComponent(11)
Dim theComponentName(11)
theComponent(0) = "ADODB.Connection"
theComponent(1) = "SoftArtisans.FileUp"
theComponent(2) = "AspHTTP.Conn"
theComponent(3) = "AspImage.Image"
theComponent(4) = "LastMod.FileObj"
theComponent(5) = "Scripting.FileSystemObject"
theComponent(6) = "SMTPsvg.Mailer"
theComponent(7) = "CDONTS.NewMail"
theComponent(8) = "Jmail.smtpmail"
theComponent(9) = "SmtpMail.SmtpMail.1"
theComponent(10) = "Persits.Upload.1"
theComponent(11) = "UnitedBinary.AutoImageSize"
theComponentName(0) = "ADODB"
theComponentName(1) = "SA-FileUp"
theComponentName(2) = "AspHTTP"
theComponentName(3) = "AspImage"
theComponentName(4) = "LastMod"
theComponentName(5) = "FileSystemObject"
theComponentName(6) = "ASPMail"
theComponentName(7) = "CDONTS"
theComponentName(8) = "JMail"
theComponentName(9) = "SMTP"
theComponentName(10) = "Persits Upload"
theComponentName(11) = "AutoImageSize"
Function IsObjInstalled(strClassString)
On Error Resume Next
IsObjInstalled = False
Err = 0
Dim xTestObj
Set xTestObj = Server.CreateObject(strClassString)
If 0 = Err Then IsObjInstalled = True
Set xTestObj = Nothing
Err = 0
End Function
%>
     
<% '以表格形式循环输出检测内容
Dim i
  For i=0 to UBound(theComponent)
  If Not IsObjInstalled(theComponent(i)) Then
   Else
     Response.Write "<table><tr>" & vbCrLf
    Response.Write "<td width=""100%"">" & vbCrLf
    Response.Write "<b>" & theComponentName(i) & "</b>" & vbCrLf
    Response.Write "</td>" & vbCrLf
   Response.Write "</tr></table>" & vbCrLf
      End If
      Next 
      %>



使用方法:

1.将以上代码直接引入需要页面即可

  
 本文Tags组件  
 收藏本文  打印本文  论坛讨论  关闭窗口
· 上一篇:控制输出字符串长度(自动区别中英文)
· 下一篇:获取服务器端信息
· 关于vbscript 与 javascript如何传递变量(包括服务器端与客户端)
· 微软建议的ASP性能优化28条守则(5)
· 在ASP网站设计中表单验证
· 如何实现大小写完全匹配的查询
· 二十八条改善 ASP 性能和外观的技巧(22-28)


关于本站 | 联系我们 | 业务合作 | 客户案例 | 诚聘英才 | 广告合作 | 收藏本站
海口动网先锋网络科技有限公司版权所有
Copyright © 2000 - 2006 Cndw.Com
中华人民共和国电信与信息服务业务经营许可证编号 琼 ICP 020077