Reading File From Server

Discussion in 'ASP General' started by Arpan, Sep 30, 2003.

  1. Arpan

    Arpan Guest

    Consider the following code snippet:

    <%
    Dim objFSO,objOpenFile,strPath

    strPath=Server.MapPath("ADList1.txt")
    Set objFSO=Server.CreateObject("SCRIPTING.FILESYSTEMOBJECT")
    Set objOpenFile=objFSO.OpenTextFile(strPath,1)
    Do While Not objOpenFile.AtEndOfStream
    Response.Write(objOpenFile.ReadLine() & "<br>")
    Loop
    objOpenFile.Close
    Set objOpenFile=Nothing
    Set objFSO=Nothing
    %>

    When I try to execute the above code, the code never gets executed. Neither
    am I shown a script timeout error. After a lot of investigations, I
    concluded that the code is not getting executed due to the presence of

    Set objOpenFile=objFSO.OpenTextFile(strPath,1)

    If I comment line nos. 3 to 8, then the code gets executed but as expected
    without any output. Is this happening because of some permission which has
    not been given to IIS 5.0? If so, what is it? I am working on Windows 2000
    Professional.

    Thanks,

    Arpan
     
    Arpan, Sep 30, 2003
    #1
    1. Advertising

  2. "Arpan" <> wrote in message
    news:...
    > Consider the following code snippet:
    >
    > <%
    > Dim objFSO,objOpenFile,strPath
    >
    > strPath=Server.MapPath("ADList1.txt")
    > Set objFSO=Server.CreateObject("SCRIPTING.FILESYSTEMOBJECT")
    > Set objOpenFile=objFSO.OpenTextFile(strPath,1)
    > Do While Not objOpenFile.AtEndOfStream
    > Response.Write(objOpenFile.ReadLine() & "<br>")
    > Loop
    > objOpenFile.Close
    > Set objOpenFile=Nothing
    > Set objFSO=Nothing
    > %>
    >
    > When I try to execute the above code, the code never gets executed.

    Neither
    > am I shown a script timeout error. After a lot of investigations, I
    > concluded that the code is not getting executed due to the presence of
    >
    > Set objOpenFile=objFSO.OpenTextFile(strPath,1)
    >
    > If I comment line nos. 3 to 8, then the code gets executed but as expected
    > without any output. Is this happening because of some permission which has
    > not been given to IIS 5.0? If so, what is it? I am working on Windows 2000
    > Professional.


    Do you have NAV installed?

    --
    Tom Kaminski IIS MVP
    http://www.iistoolshed.com/ - tools, scripts, and utilities for running IIS
    http://mvp.support.microsoft.com/
    http://www.microsoft.com/windowsserver2003/community/centers/iis/
     
    Tom Kaminski [MVP], Sep 30, 2003
    #2
    1. Advertising

  3. Arpan

    Ray at Guest

    Possibly http://www.aspfaq.com/2180

    Ray at work

    "Arpan" <> wrote in message
    news:...
    > Consider the following code snippet:
    >
    > <%
    >
    > Set objFSO=Server.CreateObject("SCRIPTING.FILESYSTEMOBJECT")

    objFSO=Nothing
    > %>
    >
    > When I try to execute the above code, the code never gets executed.
     
    Ray at, Sep 30, 2003
    #3
  4. Arpan

    Bob Barrows Guest

    Arpan wrote:
    >
    > Set objOpenFile=objFSO.OpenTextFile(strPath,1)
    >
    > If I comment line nos. 3 to 8, then the code gets executed but as
    > expected without any output. Is this happening because of some
    > permission which has not been given to IIS 5.0? If so, what is it? I
    > am working on Windows 2000 Professional.
    >

    http://www.aspfaq.com/show.asp?id=2180

    HTH,
    Bob Barrows
     
    Bob Barrows, Sep 30, 2003
    #4
  5. Arpan

    Arpan Guest

    Thanks Ray & Bob for the URL. That was exactly the reason why I was having
    this problem (I have been trying to get the solution since last 2
    days.......tried out everything in IIS but without any results).

    Thanks to Tom as well!!!

    Once again, many many thanks to you three.

    Regards,

    Arpan

    "Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
    news:#...
    > Possibly http://www.aspfaq.com/2180
    >
    > Ray at work
    >
    > "Arpan" <> wrote in message
    > news:...
    > > Consider the following code snippet:
    > >
    > > <%
    > >
    > > Set objFSO=Server.CreateObject("SCRIPTING.FILESYSTEMOBJECT")

    > objFSO=Nothing
    > > %>
    > >
    > > When I try to execute the above code, the code never gets executed.

    >
    >
     
    Arpan, Sep 30, 2003
    #5
    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:
    694
    Kevin Spencer
    Nov 11, 2004
  2. Luis Esteban Valencia Muñoz
    Replies:
    3
    Views:
    1,431
    Scott Allen
    Jun 4, 2005
  3. -
    Replies:
    2
    Views:
    433
    Alan Krueger
    Jul 29, 2005
  4. Replies:
    0
    Views:
    802
  5. Karim Ali

    Reading a file and resuming reading.

    Karim Ali, May 25, 2007, in forum: Python
    Replies:
    2
    Views:
    387
    Hrvoje Niksic
    May 25, 2007
Loading...

Share This Page