我爱Aspx >> Asp.Net >> 深入理解ASP中FSO的神奇功能If InStr(1, strFileContents, strSearchText, 1) then
Response.Write "< A HREF=""/" & objFile.Name & _
""">" & objFile.Name & "< /A>< BR>"
bolFileFound = True
End If
objTextStream.Close
Next
'Here's the recursion part - for each
' subfolder in this directory, run the Search function again
For Each objSubFolder in objFolder.SubFolders
Search objSubFolder
Next
End Function
为了能打开文件,FSO需要实际的文件路径,而不是web路径。比如,是c:inetpubwwwroot empindex.html, 而不是www.enfused.com/temp/index.html 或者 /temp/index.html。 为了将后者转换为前者,使用Server.MapPath("filename"), filename表示web路径名。
上面的代码将在你指定的初始目录下的文件夹的每一个子目录中执行,在这里,初始目录是指web根目录“/”。然后就简单地打开目录下的每一个文件,看看其中是否包含指定的字符串,如果找到字符串就显示那个文件的链接。
注意,随着文件和子目录数量的增加,搜索花费的时间也将增加。如果需要繁重的搜索工作,建议你采取其他的方法,比如微软公司的索引服务器Index Server。
上一篇: 用ASP木马实现FTP和解压缩
下一篇: 防范ASP木马的十大基本原则
1 2 下一页
Ҷƪл˵?
ASP内置对象Request和Response详..[05-15]
在ASP中轻松实现记录集分页显示[05-15]
ASP中使用Form和QueryString集合[05-15]
在ASP中访问和更新Cookies集合[05-15]
ASP中使用ServerVariables集合详..[05-15]
在ASP中操作HTTP报头方法分析[05-15]
ASP应用程序设计的Web状态管理分..[05-15]
解析ASP的Application和Session对..[05-15]
[asp]让你知道codepage的重要,关..[05-15]
ASP设计动态页中服务器端的处理[05-15]
借他人的程序造自己的家园 菜鸟也..[05-15]
ASP内置对象Request和Response详..[05-15]
在ASP中轻松实现记录集分页显示[05-15]
ASP中使用Form和QueryString集合[05-15]
在ASP中访问和更新Cookies集合[05-15]
ASP中使用ServerVariables集合详..[05-15]
在ASP中操作HTTP报头方法分析[05-15]
ASP应用程序设计的Web状态管理分..[05-15]
解析ASP的Application和Session对..[05-15]
[asp]让你知道codepage的重要,关..[05-15]