一個很有用的ASP代碼---檢測個人主頁提供站點是否支持組件 現在有很多支持ASP服務的個人主頁提供站點,但是困惑大家的一點就是 我怎么才能夠知道該站點是否支持某些很有用的組件是否安裝,例如一些發郵件 的組件jmail,cdo,或則檢測是否支持RDS,是否支持Index Server等等,真的很 有用耶。 你所做的是只需要把下面這個檢測文件上傳到你的個人主頁站點上,然后運行 它就可以了,呵呵,很簡單的,不用任何附加的組件哦。 檢測工具: CheckObj.asp代碼如下: <% @ Language="VBScript" %> <% Option Explicit %> <% ' 這是一些隨IIS4附帶的一些組件(默認的) Dim theInstalledObjects(8) theInstalledObjects(0) = "MSWC.AdRotator" theInstalledObjects(1) = "MSWC.BrowserType" theInstalledObjects(2) = "MSWC.NextLink" theInstalledObjects(3) = "MSWC.Tools" theInstalledObjects(4) = "MSWC.Status" theInstalledObjects(5) = "MSWC.Counters" theInstalledObjects(6) = "IISSample.ContentRotator" theInstalledObjects(7) = "IISSample.PageCounter" theInstalledObjects(8) = "MSWC.PermissionChecker" 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 %> <HTML> <HEAD> <TITLE>檢測ISP是否支持ASP組件的工具</TITLE> </HEAD> <BODY> 在下面的輸入框中輸入你要檢測的組件的ProgId或則ClassId. 如果你沒有輸入的話,將使用默認值。 <FORM action=<%=Request.ServerVariables("SCRIPT_NAME")%> method=post> <input type=text value="" name="classname" size=40> <INPUT type=submit value=Submit> <INPUT type=reset value=Reset> </FORM> <% Dim strClass strClass = Trim(Request.Form("classname")) If "" <> strClass then Response.Write strClass & " " If Not IsObjInstalled(strClass) then Response.Write "<strong>沒有安裝,本主頁提供站點不支持這個組件</strong>" Else Response.Write "安裝了,本主頁提供站點支持使用這個組件!" End If Response.Write "<P>" & vbCrLf Else %> <TABLE BORDER=0> <% Dim i For i=0 to UBound(theInstalledObjects) Response.Write "<TR><TD>" & theInstalledObjects(i) & "</TD><TD>" If Not IsObjInstalled(theInstalledObjects(i)) Then Response.Write "<strong>沒有安裝,本主頁提供站點不支持這個組件</strong>" Else Response.Write "安裝了,本主頁提供站點支持使用這個組件!" End If Response.Write "</TD></TR>" & vbCrLf Next %> </TABLE> <% End If %> </BODY> </HTML> 我提供這個工具是希望大家把自己的主頁越辦越好,能夠充分利用 你的個人主頁站點提供給你的組件做出技術水平更高的ASP主頁出來。 好運。 (出處:熱點網絡)
|