Discuz教程网

asp中判断服务器是否安装了某种组件的函数

[复制链接]
authicon dly 发表于 2011-9-14 09:02:03 | 显示全部楼层 |阅读模式
判断服务器是否安装了某种asp组件,比较常用的代码如下:
  1. <%
  2. '功能:检查是否存在系统组件或组件是否安装成功
  3. '参数:组件名
  4. Function IsObjInstalled(strClassString)
  5. On Error Resume Next
  6. IsObjInstalled = False
  7. Err = 0
  8. Dim xTestObj
  9. Set xTestObj = Server.CreateObject(strClassString)
  10. If 0 = Err Then IsObjInstalled = True
  11. Set xTestObj = Nothing
  12. Err = 0
  13. End Function
  14. '获取系统组件的版本号
  15. Function getver(Classstr)
  16. On Error Resume Next
  17. getver=""
  18. Err = 0
  19. Dim xTestObj
  20. Set xTestObj = Server.CreateObject(Classstr)
  21. If 0 = Err Then getver=xtestobj.version
  22. Set xTestObj = Nothing
  23. Err = 0
  24. End Function
  25. %>
复制代码


调用方法如:
  1. <%
  2. if IsObjInstalled("fso.file") =True then
  3. response.write("已经安装")&getver("fso.file")
  4. end if
  5. %>
复制代码



上一篇:ASP的URLDecode函数URLEncode解码函数
下一篇:asp 页面允许CACHE的方法
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

1314学习网 ( 浙ICP备10214163号 )

GMT+8, 2025-5-2 07:33

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表