Problem with reading a text file

Discussion in 'ASP General' started by Suchi, May 8, 2004.

  1. Suchi

    Suchi Guest

    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?
     
    Suchi, May 8, 2004
    #1
    1. Advertising

  2. > 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/
     
    Aaron Bertrand [MVP], May 8, 2004
    #2
    1. Advertising

  3. Suchi

    Dominique Guest

    > 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?
    >
    >
     
    Dominique, May 10, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Darrel
    Replies:
    3
    Views:
    679
    Kevin Spencer
    Nov 11, 2004
  2. Replies:
    0
    Views:
    787
  3. Replies:
    1
    Views:
    454
    Keith Thompson
    Apr 12, 2005
  4. Lionel
    Replies:
    22
    Views:
    658
    Steve Holden
    Feb 3, 2009
  5. Robin Wenger
    Replies:
    191
    Views:
    3,242
Loading...

Share This Page