Search Tools Links Login

Search web site

Search the web site

Original Author: Bhushan-


As the website increases you should provide an option for the user to trace out what he is looking for, in a very short time. For this reason search this website help you a lot.
Open your favorite editor and paste this code their. save the file as textsearch.asp.
Search Results for :- <%=Request("SearchText")%>

Const fsoForReading = 1
Dim strSearchText
strSearchText = Request("SearchText")
'Now, we want to search all of the files
Dim objFSO
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Dim objFolder
Set objFolder = objFSO.GetFolder(Server.MapPath("/news"))
Dim objFile, objTextStream, strFileContents, bolFileFound
bolFileFound = False
dim count
For Each objFile in objFolder.Files
If Response.IsClientConnected then
Set objTextStream = objFSO.OpenTextFile(objFile.Path,fsoForReading)
strFileContents = objTextStream.ReadAll
If InStr(1,strFileContents,strSearchText,1) then
Response.Write "

  • """>" & objFile.Name & "
    'This program will do the search in the path specified only. if you want it to search through all your 'directories/folders use a different logic. here i have specified the path as /news. change the path accordingly.
    Response.Write "" & objFile.Name & "
    Response.Write ("
    bolFileFound = True
    End If
    End If
    if Not bolFileFound then
    Response.Write "No matches found..."
    Response.Write "Total no of pages found=" & count & "
    'Response.Write "click for more information:-.." & "
    end if
    Set objTextStream = Nothing
    Set objFolder = Nothing
    Set objFSO = Nothing
    Next open another page and type in the following code;

  • About this post

    Posted: 2002-06-01
    By: ArchiveBot
    Viewed: 86 times




    No attachments for this post

    Loading Comments ...


    No comments have been added for this post.

    You must be logged in to make a comment.