Asp checks whether a component is installed on the server, that is, whether a dll file is installed, and whether a component is registered on the server. There are many asp components, which can reduce many asp errors, the following functions are used:
Copy codeThe Code is as follows: <%
'Function: Check whether system components or components are successfully installed.
'Parameter: component name
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
'Get the version number of the system component
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
%>
The call method is as follows:Copy codeThe Code is as follows: <%
If IsObjInstalled ("fso. file") = True then
Response. write ("installed") & getver ("fso. file ")
End if
%>