Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

GetFolder causes page to spin forever

Status
Not open for further replies.

earme

Programmer
Jul 27, 2000
155
US
Hello,

My page never finishes loading, it just sits and runs forever. And then if I stop it and attempt to view another asp page it does the same thing. However, if I open a new window (start a new session) then it runs fine, until I attempt to load that specific page.
By placing a series of Response.write and response.flush's I was able to track it down to my GetFolder call. The I_USER account has access to read it, so I'm not sure what the problem is.
Here's the code:
Code:
dim objFileSys		'File system object
dim objFolder		'Folder Object
dim objFiles		'Files Object
dim strFolder		'string containing folder location
strFolder = "c:\custrefs"

set objFileSys = Server.CreateObject("Scripting.FileSystemObject")
set objFolder = objFileSys.GetFolder(strFolder)
set objFiles = objFolder.Files

For each item in objFiles
   If lcase(right(item.name,7)) = "001.txt" Then
      Response.write(item.name & &quot;<BR>&quot;)
   End If
Next
set objFiles = nothing
set objFolder = nothing
set objFileSys = nothing

Any suggestions?

Earme

ps. Thanks Ovatvvon for getting me this far :)
 
Have you determined whether you're in an infinite loop, or whether the page is hanging?

Modify:

For each item in objFiles
If lcase(right(item.name,7)) = &quot;001.txt&quot; Then
Response.write(item.name & &quot;<BR>&quot;)
End If
Next


to be:

dim i
i = 0
For each item in objFiles
response.write(i & &quot;<br>&quot;)
If lcase(right(item.name,7)) = &quot;001.txt&quot; Then
Response.write(item.name & &quot;<BR>&quot;)
End If
i = i + 1
Next


What does it tell you?

:)
paul
penny1.gif
penny1.gif
 
Paul: My code isn't actually getting to the loop part. It's hanging up on &quot;set objFolder = objFileSys.GetFolder(strFolder)&quot;. I know this because I placed a series of Response.write's and response.Flush's.

JohnYingling:
I tried turning off and unloading Norton. It still got hung up. However, I decided to reboot (having told Norton not to load when Windows loads) and try it again and this time it worked fine. Thanks!

Thank you both for your suggestions!
Earme
 
Ok, another question. Now that I know that it's Norton that's causing the problem, is there a way to allow Norton to run, but also allow my code to run?

Earme
 
Yes, you just need to disable Script Blocking inside your Norton AntiVirus, start it running, and all will be well again. I had this same problem and it stumped me for weeks.

Script Blocking by default is set to Enabled (which says it will prompt you but ti doesn't), but it just stops all FSO activity. Ahdkaw
&quot;Get that ST away from me!!!&quot;
Where the sensible gather... or so they say.
 
Ahdkaw,
Thank you! It worked great, although I had to reboot, not sure why, but it worked fine after that.

Thanks again,
Earme
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top