<%@ Language="VBScript" %> 002 <%' Option Explicit %> 003 010 <% 011 Dim starttime 012 starttime=timer()*1000 013 '声明待检数组 014 Dim ObjTotest(26,4) 015 ObjTotest(0,0) = "MSWC.AdRotator" 016 ObjTotest(1,0) = "MSWC.BrowserType" 017 ObjTotest(2,0) = "MSWC.NextLink" 018 ObjTotest(3,0) = "MSWC.Tools" 019 ObjTotest(4,0) = "MSWC.Status" 020 ObjTotest(5,0) = "MSWC.Counters" 021 ObjTotest(6,0) = "IISSample.ContentRotator" 022 ObjTotest(7,0) = "IISSample.PageCounter" 023 ObjTotest(8,0) = "MSWC.PermissionChecker" 024 ObjTotest(9,0) = "Scripting.FileSystemObject" 025 ObjTotest(9,1) = "(FSO 文本文件读写)" 026 ObjTotest(10,0) = "adodb.connection" 027 ObjTotest(10,1) = "(ADO 数据对象)" 028 ObjTotest(11,0) = "DownloadClassAsp.DownSysObject" 029 ObjTotest(11,1) = "(下载管理系统组件)" 030 ObjTotest(12,0) = "SoftArtisans.FileUp" 031 ObjTotest(12,1) = "(SA-FileUp 文件上传)" 032 ObjTotest(13,0) = "SoftArtisans.FileManager" 033 ObjTotest(13,1) = "(SoftArtisans 文件管理)" 034 ObjTotest(14,0) = "LyfUpload.UploadFile" 035 ObjTotest(14,1) = "(刘云峰的文件上传组件)" 036 ObjTotest(15,0) = "Persits.Upload.1" 037 ObjTotest(15,1) = "(ASPUpload 文件上传)" 038 ObjTotest(16,0) = "w3.upload" 039 ObjTotest(16,1) = "(Dimac 文件上传)" 040 041 ObjTotest(17,0) = "JMail.SmtpMail" 042 ObjTotest(17,1) = "(Dimac JMail 邮件收发) " 043 ObjTotest(18,0) = "CDONTS.NewMail" 044 ObjTotest(18,1) = "(虚拟 SMTP 发信)" 045 ObjTotest(19,0) = "Persits.MailSender" 046 ObjTotest(19,1) = "(ASPemail 发信)" 047 ObjTotest(20,0) = "SMTPsvg.Mailer" 048 ObjTotest(20,1) = "(ASPmail 发信)" 049 ObjTotest(21,0) = "DkQmail.Qmail" 050 ObjTotest(21,1) = "(dkQmail 发信)" 051 ObjTotest(22,0) = "Geocel.Mailer" 052 ObjTotest(22,1) = "(Geocel 发信)" 053 ObjTotest(23,0) = "IISmail.Iismail.1" 054 ObjTotest(23,1) = "(IISmail 发信)" 055 ObjTotest(24,0) = "SmtpMail.SmtpMail.1" 056 ObjTotest(24,1) = "(SmtpMail 发信)" 057 058 ObjTotest(25,0) = "SoftArtisans.ImageGen" 059 ObjTotest(25,1) = "(SA 的图像读写组件)" 060 ObjTotest(26,0) = "W3Image.Image" 061 ObjTotest(26,1) = "(Dimac 的图像读写组件)" 062 public IsObj,VerObj,TestObj 063 '检查预查组件支持情况及版本 064 dim i 065 for i=0 to 26 066 on error resume next 067 IsObj=false 068 VerObj="" 069 'dim TestObj 070 TestObj="" 071 set TestObj=server.CreateObject(ObjTotest(i,0)) 072 If -2147221005 <> Err then '感谢网友iAmFisher的宝贵建议 073 IsObj = True 074 VerObj = TestObj.version 075 if VerObj="" or isnull(VerObj) then VerObj=TestObj.about 076 end if 077 ObjTotest(i,2)=IsObj 078 ObjTotest(i,3)=VerObj 079 next 080 '检查组件是否被支持及组件版本的子程序 081 sub ObjTest(strObj) 082 on error resume next 083 IsObj=false 084 VerObj="" 085 TestObj="" 086 set TestObj=server.CreateObject (strObj) 087 If -2147221005 <> Err then '感谢网友iAmFisher的宝贵建议 088 IsObj = True 089 VerObj = TestObj.version 090 if VerObj="" or isnull(VerObj) then VerObj=TestObj.about 091 end if 092 End sub 093 %> 094 095 096 服务器的相关信息 097 098 099 100 101 102 103 104 105
服 务 器 信 息
106 你的服务器是否支持ASP 107
出现以下情况即表示您的空间不支持ASP: 108
1、访问本文件时提示下载。 109
2、访问本文件时看到类似“<%@ Language="VBScript" %>”的文字。 110

111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
■ 服务器的有关参数
 服务器名 <%=Request.ServerVariables("SERVER_NAME")%>
 服务器IP <%=Request.ServerVariables("LOCAL_ADDR")%>
 服务器端口 <%=Request.ServerVariables("SERVER_PORT")%>
 服务器时间 <%=now%>
 IIS版本 <%=Request.ServerVariables("SERVER_SOFTWARE")%>
 脚本超时时间 <%=Server.ScriptTimeout%> 秒
 本文件路径 <%=Request.ServerVariables("PATH_TRANSLATED")%>
 服务器CPU数量 <%=Request.ServerVariables("NUMBER_OF_PROCESSORS")%> 个
 服务器解译引擎 <%=ScriptEngine & "/"& ScriptEngineMajorVersion &"."&ScriptEngineMinorVersion&"."& ScriptEngineBuildVersion %>
 服务器操作系统 <%=Request.ServerVariables("OS")%>
144
145 <% 146 Dim strClass 147 strClass = Trim(Request.Form("classname")) 148 If "" <> strClass then 149 Response.Write "
您指定的组件的检查结果:" 150 Dim Verobj1 151 ObjTest(strClass) 152 If Not IsObj then 153 Response.Write "
很遗憾,该服务器不支持 " & strclass & " 组件!" 154 Else 155 if VerObj="" or isnull(VerObj) then 156 Verobj1="无法取得该组件版本" 157 Else 158 Verobj1="该组件版本是:" & VerObj 159 End If 160 Response.Write "
恭喜!该服务器支持 " & strclass & " 组件。" & verobj1 & "" 161 End If 162 Response.Write "
" 163 end if 164 %> 165 166 167 168 <%For i=0 to 10%> 169 170 171 177 178 <%next%> 179
■ IIS自带的ASP组件
组 件 名 称支持及版本
 <%=ObjTotest(i,0) & " " & ObjTotest(i,1)%> <% 172 If Not ObjTotest(i,2) Then 173 Response.Write "×" 174 Else 175 Response.Write " " & left(ObjTotest(i,3),11) & "" 176 End If%>
180 181
182 183 184 185 <%For i=11 to 16%> 186 187 188 194 195 <%next%> 196
■ 常见的文件上传和管理组件
组 件 名 称支持及版本
 <%=ObjTotest(i,0) & " " & ObjTotest(i,1)%> <% 189 If Not ObjTotest(i,2) Then 190 Response.Write "×" 191 Else 192 Response.Write " " & left(ObjTotest(i,3),11) & "" 193 End If%>
197 198
199 200 201 202 <%For i=17 to 24%> 203 204 205 211 212 <%next%> 213
■ 常见的收发邮件组件
组 件 名 称支持及版本
 <%=ObjTotest(i,0) & " " & ObjTotest(i,1)%> <% 206 If Not ObjTotest(i,2) Then 207 Response.Write "×" 208 Else 209 Response.Write " " & left(ObjTotest(i,3),11) & "" 210 End If%>
214
215 216 217 218 <%For i=25 to 26%> 219 220 221 227 228 <%next%> 229
■ 图像处理组件
组 件 名 称支持及版本
 <%=ObjTotest(i,0) & " " & ObjTotest(i,1)%> <% 222 If Not ObjTotest(i,2) Then 223 Response.Write "×" 224 Else 225 Response.Write " " & left(ObjTotest(i,3),11) & "" 226 End If%>
230 231
232 233 234 236 method=post id=form1 name=form1> 237 238 242 243 244
■ 其他组件支持情况检测
235 在下面的输入框中输入你要检测的组件的ProgId或ClassId。
239 240 241
245 246 <%if ObjTest("Scripting.FileSystemObject") then 247 248 set fsoobj=server.CreateObject("Scripting.FileSystemObject") 249 250 %> 251 252
253 254 255 256 257 258 259 260 261 262 263 <% 264 265 ' 测试磁盘信息的想法来自“COCOON ASP 探针” 266 267 set drvObj=fsoobj.Drives 268 for each d in drvObj 269 %> 270 271 272 <% 273 if d.DriveLetter = "A" then '为防止影响服务器,不检查软驱 274 Response.Write "" 275 else 276 %> 277 278 279 280 281 282 <% 283 end if 284 %> 285 286 <% 287 next 288 %> 289 290
■ 服务器磁盘信息
盘符和磁盘类型就绪卷标文件系统可用空间总空间
<%=cdrivetype(d.DriveType) & " " & d.DriveLetter%>:<%=cIsReady(d.isReady)%><%=d.VolumeName%><%=d.FileSystem%><%=cSize(d.FreeSpace)%><%=cSize(d.TotalSize)%>
291 292
293 294 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315
■ 当前文件夹信息 <% 295 dPath = server.MapPath("./") 296 set dDir = fsoObj.GetFolder(dPath) 297 set dDrive = fsoObj.GetDrive(dDir.Drive) 298 %> 299 文件夹: <%=dPath%>
已用空间可用空间文件夹数文件数创建时间
<%=cSize(dDir.Size)%><%=cSize(dDrive.AvailableSpace)%><%=dDir.SubFolders.Count%><%=dDir.Files.Count%><%=dDir.DateCreated%>
316
317 318 319 320 359 360 361 362
■ 磁盘文件操作速度测试
<% 321 Response.Write "正在重复创建、写入和删除文本文件50次..." 322 dim thetime3,tempfile,iserr 323 iserr=false 324 t1=timer 325 tempfile=server.MapPath("./") & "\aspchecktest.txt" 326 for i=1 to 50 327 Err.Clear 328 set tempfileOBJ = FsoObj.CreateTextFile(tempfile,true) 329 if Err <> 0 then 330 Response.Write "创建文件错误!" 331 iserr=true 332 Err.Clear 333 exit for 334 end if 335 tempfileOBJ.WriteLine "Only for test. Ajiang ASPcheck" 336 if Err <> 0 then 337 Response.Write "写入文件错误!" 338 iserr=true 339 Err.Clear 340 exit for 341 end if 342 tempfileOBJ.close 343 Set tempfileOBJ = FsoObj.GetFile(tempfile) 344 tempfileOBJ.Delete 345 if Err <> 0 then 346 Response.Write "删除文件错误!" 347 iserr=true 348 Err.Clear 349 exit for 350 end if 351 set tempfileOBJ=nothing 352 next 353 t2=timer 354 if iserr <> true then 355 thetime3=cstr(int(( (t2-t1)*10000 )+0.5)/10) 356 Response.Write "...已完成!" & thetime3 & "毫秒。" 357 %> 358
 您的服务器: <%=Request.ServerVariables("SERVER_NAME")%>  <%=thetime3%>
363 <% 364 end if 365 set fsoobj=nothing 366 end if%> 367
368 369 370 371 393 394 395 396
■ ASP脚本解释和运算速度测试
372 <% 373 '因为只进行50万次计算,所以去掉了是否检测的选项而直接检测 374 Response.Write "整数运算测试,正在进行50万次加法运算..." 375 dim t1,t2,lsabc,thetime,thetime2 376 t1=timer 377 for i=1 to 500000 378 lsabc= 1 + 1 379 next 380 t2=timer 381 thetime=cstr(int(( (t2-t1)*10000 )+0.5)/10) 382 Response.Write "...已完成!" & thetime & "毫秒
" 383 Response.Write "浮点运算测试,正在进行20万次开方运算..." 384 t1=timer 385 for i=1 to 200000 386 lsabc= 2^0.5 387 next 388 t2=timer 389 thetime2=cstr(int(( (t2-t1)*10000 )+0.5)/10) 390 Response.Write "...已完成!" & thetime2 & "毫秒
" 391 %> 392
 您的服务器: <%=Request.ServerVariables("SERVER_NAME")%>  <%=thetime%> <%=thetime2%>
397
398 399 402
400 服务器执行时间:160.0毫秒 页面装载: 秒 401
403 404 405 <% 406 function cdrivetype(tnum) 407 Select Case tnum 408 Case 0: cdrivetype = "未知" 409 Case 1: cdrivetype = "可移动磁盘" 410 Case 2: cdrivetype = "本地硬盘" 411 Case 3: cdrivetype = "网络磁盘" 412 Case 4: cdrivetype = "CD-ROM" 413 Case 5: cdrivetype = "RAM 磁盘" 414 End Select 415 end function 416 function cIsReady(trd) 417 Select Case trd 418 case true: cIsReady="" 419 case false: cIsReady="×" 420 End Select 421 end function 422 function cSize(tSize) 423 if tSize>=1073741824 then 424 cSize=int((tSize/1073741824)*1000)/1000 & " GB" 425 elseif tSize>=1048576 then 426 cSize=int((tSize/1048576)*1000)/1000 & " MB" 427 elseif tSize>=1024 then 428 cSize=int((tSize/1024)*1000)/1000 & " KB" 429 else 430 cSize=tSize & "B" 431 end if 432 end function 433 %>