Check whether system components exist or whether the components are installed successfully to facilitate continued operation. Give users better information instructions. To determine whether the server has a certain asp component installed, the more commonly used code is as follows:
Copy the code code as follows:
<%
'Function: Check whether system components exist or whether the components are installed successfully
'Parameter: component name
Function IsObjInstalled(strClassString)
On Error Resume Next
IsObjInstalled = False
Err = 0
DimxTestObj
Set xTestObj = Server.CreateObject(strClassString)
If 0 = Err Then IsObjInstalled = True
Set xTestObj = Nothing
Err = 0
End Function
'Get the version number of the system component
Function getver(Classstr)
On Error Resume Next
getver=
Err = 0
DimxTestObj
Set xTestObj = Server.CreateObject(Classstr)
If 0 = Err Then getver=xtestobj.version
Set xTestObj = Nothing
Err = 0
End Function
%>
The calling method is as follows:
Copy the code code as follows:
<%
if IsObjInstalled(fso.file) =True then
response.write(already installed)&getver(fso.file)
end if
%>