IIS与FileSystemObject的问题!!!
在XP下的IIS5.1中使用FileSystemObject的GetFolder方法有什么需要注意的吗????
我的程序Set Fold=Server.CreateObject("Scripting.FileSystemObject")
Set FoldList=Fold.GetFolder(server.MapPath ("../Admin/tools"))
运行到第二句,网页就没响应了,也不报错,但在同事的Win2000Pro下就没问题,这是为什么???
附:我的原程序,经检查就是运行到Set FoldList=Fold.GetFolder(Server.MapPath(Path))这句出的问题,把整个Windows系统都拖慢了,只能重启IIS。
程序:列指定目录下的文件夹
<% @Language = "VBScript" %>
<%
response.buffer=true
Server.Scripttimeout=5
Session("FoldLev")=request("Lev")
If Session("FoldLev")="" or not(IsNumeric(Session("FoldLev"))) or Session("FoldLev")>10 or Session("FoldLev")<1 Then
Session("FoldLev")=3
End if
If request("Path")="" then
Path="../Userservice/Download/Content"
Else
Path=request("Path")
End if
response.write "<Select Name=""FoldList"" Size=""1"">"
response.write "<Option>"&Mid(Path,InstrRev(replace(Path,"\","/"),"/",Len(Path)-1)+1)&"</Option>"
Dim a(11)
'调用子程序,a表示它是否为第a级目录的最后一个子目录
Call FoldListSub(Path,Session("FoldLev"))
response.write "</Select>"
function FoldListSub (Path,Lev)
Set Fold=Server.CreateObject("Scripting.FileSystemObject")
Set FoldList=Fold.GetFolder(Server.MapPath(Path))
If FoldList.SubFolders.count>0 Then
j=1
For each i in FoldList.SubFolders
response.write i.name&"<br>"
Flag=Len(Server.MapPath(Path&"\"&i.name))
'判断当前应该截取第几级目录
For k=1 to Session("FoldLev")-Lev+1
Flag=InstrRev(replace(Server.MapPath(Path&"\"&i.name),"\","/"),"/",Flag-1)
exit for
Next
If j=FoldList.SubFolders.count Then
a(Lev)=1
nbsp=""
'产生格式
For k=1 to (Session("FoldLev")-Lev)*2
If (k=1 or k/2<>k\2) and a(Session("FoldLev")-(k-1)/2)<>1 Then
nbsp=nbsp&"│"
Else
nbsp=nbsp&" "
End if
exit for
Next
response.write "<Option Value="""&Mid(Server.MapPath(Path&"\"&i.name),Flag+1)&""">" &"└"&i.name&"</Option>"
'判断它是哪级目录的最后一个子目录,用于确定制表符的格式
Else
a(Lev)=0
nbsp=""
'产生格式
For k=1 to (Session("FoldLev")-Lev)*2
If (k=1 or k/2<>k\2) and a(Session("FoldLev")-(k-1)/2)<>1 Then
nbsp=nbsp&"│"
Else
nbsp=nbsp&" "
End if
exit for
Next
response.write "<Option Value="""&Mid(Server.MapPath(Path&"\"&i.name),Flag+1)&""">" &"├"&i.name&"</Option>"
End if
'If Lev>1 Then
'Call FoldListSub(Path&"\"&i.name,Lev-1)
'End if
j=j+1
exit for
Next
End if
end function
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta http-equiv="Content-Language" content="zh-cn">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
</head>
<body topmargin="0" leftmargin="0">