Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Problem with reading a text file

Reply
Thread Tools

Problem with reading a text file

 
 
Suchi
Guest
Posts: n/a
 
      05-08-2004
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?


 
Reply With Quote
 
 
 
 
Aaron Bertrand [MVP]
Guest
Posts: n/a
 
      05-08-2004
> 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/


 
Reply With Quote
 
 
 
 
Dominique
Guest
Posts: n/a
 
      05-10-2004
> 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" <> wrote in message
news:...
> 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?
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Reading LAST line from text file without iterating through the file? Robin Wenger Java 191 03-26-2011 06:19 PM
Reading text file with wierd file extension? Lionel Python 22 02-03-2009 10:27 PM
UnauthorizedAccessException when reading XML files (no problem when reading other file-types) blabla120@gmx.net ASP .Net 0 09-15-2006 02:08 PM
reading from text file to excel file mail2atulmehta@yahoo.com C Programming 1 04-12-2005 07:50 PM
reading the DB vs. reading a text file...performance preference? Darrel ASP .Net 3 11-11-2004 02:27 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57