<% Option Explicit %>
  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  <html>
  <head>
  <title>XMLHTTP Request Object</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  </head>
  <body>
  <%
  'put the objects that we wish to test for into a declared array
Dim InstalledObjects(4)
InstalledObjects(0) ="Microsoft.XMLHTTP"
  InstalledObjects(1) ="Msxml2.ServerXMLHTTP"
  InstalledObjects(2) ="MSXML2.ServerXMLHTTP"
  InstalledObjects(3) ="MSXML2.XMLHTTP.3.0"
  InstalledObjects(4) ="MSXML2.XMLHTTP.4.0"
Function ObjCreated(sClass)
  'create variable
  Dim ObjInstance
  On Error Resume Next
  'initialize default values
  ObjCreated = False
  'create instance of the class - an object
  Set ObjInstance = Server.CreateObject(sClass)
  If Err.Number=0 Then ObjCreated = True
  'close object
  Set ObjInstance = Nothing
  Err.Clear
  End Function
  %>
  <table border="0">
  <%
  Dim i
  For i=0 to UBound(InstalledObjects)
  Response.Write "<tr><td>" & InstalledObjects(i) & "</td><td>"
  If ObjCreated(InstalledObjects(i)) Then
  Response.Write "<strong>Installed</strong>"
  Else
  Response.Write "<strong>not installed</strong>"
  End If
  Response.Write "</td></tr>"
  Next
  %>
  </table>
  </body>
  </html>
0 Comments:
Post a Comment