判断服务器是否安装了某种asp组件,比较常用的代码如下:- <%
- '功能:检查是否存在系统组件或组件是否安装成功
- '参数:组件名
- 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
- '获取系统组件的版本号
- Function getver(Classstr)
- On Error Resume Next
- getver=""
- Err = 0
- Dim xTestObj
- Set xTestObj = Server.CreateObject(Classstr)
- If 0 = Err Then getver=xtestobj.version
- Set xTestObj = Nothing
- Err = 0
- End Function
- %>
复制代码
调用方法如:- <%
- if IsObjInstalled("fso.file") =True then
- response.write("已经安装")&getver("fso.file")
- end if
- %>
复制代码 |