View Full Version : error in FSO object!

02-11-2003, 10:05 AM

The search engine article at 4guysfromrolla is great, easy to code and understand, I try to run the original file before modifying it, and found that it got error, can anyone of you help??

The error is :

Error Type:
Microsoft VBScript runtime (0x800A003E)
Input past end of file

The article can be accessed at http://www.4guysfromrolla.com/webtech/102499-1.shtml

Please advice!

Roy Sinclair
02-11-2003, 02:47 PM
That looks like the result you get when you have a zero length file and try to read from it before you check to see if you are at EOF.

02-11-2003, 11:53 PM
If not file.AtEndOfStream Then
'Do your FSO stuff here...
End If

Is one way to do it... :D

02-12-2003, 10:48 PM
hi charon

i am going to start doing a search engine as well, but just wanted to double check if this code can be used with any servers regardless if it supports index server or anything.

Thanks :)

02-13-2003, 12:17 AM
FileSystemObject should work fine as long as it has read permissions (and write permissions if you're using it to write to files) on the directories in question.

02-13-2003, 02:08 AM
Thanks whammy and roy, it works great.....
I wonder why 4guysfromrolla don't want to correct the code.

BUT, I face a problem on the specifying the URL.
Ok, let me decribe a bit on how what approach I'm taking or creating my web-site.

Guess I'm using "not a common" way for creating my web-site.
I create a templete which is in .asp format, and all the content is in .inc format (except some in .asp).
I use FSO to maniplulate the content.

When the user activate the link for the navigator, the name of the file will be passed to the function:

For instance:

Function getContent(fileInclude)
Dim objFSO
Dim objText
Dim strPage

Set objFSO = Server.CreateObject("Scripting.FileSystemObject")

Set objText = objFSO.OpenTextFile(Server.MapPath(fileInclude))

getContent = objText.ReadAll

Set objText = Nothing
Set objFSO = Nothing

End Function

nameFile = Request.QueryString("nf") "http://www.sitename.com/default.asp?action=feature&cid=0

If nameFile <> "" and codeID = "0" Then 'the code ID is to indicate the condition of the file
fileName = nameFile & ".inc"
strPage = getContent(fileName)
ElseIf ..........
ElseIf ..........
End If

1.)I really don't know what approach should i take for creating my search engine.
After a long searching, I'm thinking of adopting one of these way:
Way1: using the index server 3 (http://asp-help.com/articles/2000_indexserver3.asp). I feel it is easy to understand and implement. But I still have problem on specifying the URL of the pages. May be I need to manually create the link. What I mean to manually create the link is I use the split function (or may be FSO object) to split the URL return by Vpath : for instances:

"http://www.website.com/" & Foldername & "action=" & FileName & "cid=" & id &

Way2: use FSO method, but I 'm facing problem on get the decription of the file since the File object don't have this property.

Way3 : Create a database with 3 fields -> Doc_ title, Doc_ decription, and Doc_URL and use SQL statement as below:
select Doc_decription
from yourtable
where memofield like '*Word1*'
or memofield like '*Word2*'

to search for the match.

I don't know whether they are applicable or not.

2.) I'm wondering how do most of the web-sites implement their search engine, for example: asp101.com.
Their content is in database -driven format as well as static content which is wtitten in .asp and html format.

3.) I don't know whether what i'm thinking is the correct way, is the asp101.com search engine is implemented in such as way where by it searchs the page through the database which has fields such as

Doc Title
Doc Decription
Doc Id

Please advice!!! I 'm lost......