469,275 Members | 1,871 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,275 developers. It's quick & easy.

Problem with reading a text file

Hi all:

I want to read a textfile from an ASP program.
My program is like this:

Set fso = CreateObject("Scripting.FileSystemObject")
workFile=http://localhost/Readme.txt)
Set textFile = FSObj.OpenTextFile(workFile)
lines = split(textFile.ReadAll, VBCrLf)
textFile.Close
Set textFile = nothing
Set fso = nothing

for index = 0 to UBound(lines)
Response.write lines(index)
next

But the program is crashing the IIS.

Think this is related to permission problem. I gave full permission to all
user accounts
in the system. still not working

Can any one help me?
Jul 19 '05 #1
2 1674
> But the program is crashing the IIS.

What the heck does "crashing" mean? Do you get an error? If so, what is
it? Else, can you describe the actual symptom, rather than the vague and
ambiguous word "crashing"?

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
Jul 19 '05 #2
> workFile=http://localhost/Readme.txt)
?? whether or not that's a typo, just point to the full path of the file
like so:
workfile = "c:\inetpub\wwwroot\Readme.txt"
and put it in quotes
THEN worry about the rest of your routine...

you should read up on a bit of error trapping.

add this line to the top of your the abovementioned routine

On Error Resume Next

and below it:

if Err.Number <> 0 then
Response.write Err.Description
Response.end
end if
at least you'll be able to give us a little more than "the program is
crashing the IIS"

cheers and good luck
"Suchi" <su***@inapp.com> wrote in message
news:eJ**************@TK2MSFTNGP11.phx.gbl...
Hi all:

I want to read a textfile from an ASP program.
My program is like this:

Set fso = CreateObject("Scripting.FileSystemObject")
workFile=http://localhost/Readme.txt)
Set textFile = FSObj.OpenTextFile(workFile)
lines = split(textFile.ReadAll, VBCrLf)
textFile.Close
Set textFile = nothing
Set fso = nothing

for index = 0 to UBound(lines)
Response.write lines(index)
next

But the program is crashing the IIS.

Think this is related to permission problem. I gave full permission to all
user accounts
in the system. still not working

Can any one help me?

Jul 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by fabrice | last post: by
2 posts views Thread by Sabin Finateanu | last post: by
2 posts views Thread by Mad Scientist Jr | last post: by
5 posts views Thread by Scott M. Lyon | last post: by
reply views Thread by Fabrice | last post: by
6 posts views Thread by Bill Nguyen | last post: by
5 posts views Thread by Neil Crighton | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.