Reading File From Server

A

Arpan

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
 
T

Tom Kaminski [MVP]

Arpan said:
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?
 
B

Bob Barrows

Arpan said:
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
 
A

Arpan

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top