GetFile method of filesystem object hangs IIS

J

Joe

I'm trying to use the GetFile method of the filesystem
object to determine file attributes. I'm using the code
as suggested in MSDN, and find that the GetFile method
causes IIS to hang. (won't serve web pages until I
reboot.)

I've used the MapPath method to be sure I've passed a
fully qualified file name. The code I'm using from MSDN
is as follows:

<%
Function ShowFileAccessInfo(filespec)
dim fso, f, s
set fso = _
CreateObject("Scripting.FileSystemObject")
set f = fso.GetFile(filespec)
s = f.Path & "<br>"
s = s & "Created: " & f.DateCreated & "<br>"
ShowFileAccessInfo = s
End Function
%>

My code used to call this function is as follows:

<%
dim strFileName
strFileName = Server.MapPath("test.txt")
response.write "Here's the info for: " & strFileName
response.write ShowFileAccessInfo(strFileName)
%>

Thanks for any suggestions!
 
J

Jim Buyens

I just tried your code on my system and it worked fine.

Perhaps your file is locked by another application, or
you have some sort of security issue.

Jim Buyens
Microsoft FrontPage MVP
http://www.interlacken.com
Author of:
*----------------------------------------------------
|\---------------------------------------------------
|| Microsoft Office FrontPage 2003 Inside Out
|| Microsoft FrontPage Version 2002 Inside Out
|| Web Database Development Step by Step .NET Edition
|| Troubleshooting Microsoft FrontPage 2002
|| Faster Smarter Beginning Programming
|| (All from Microsoft Press)
|/---------------------------------------------------
*----------------------------------------------------
 
J

Joe

Thanks for the quick reply Jim.

My trials were on my local workstation, running Windows
2000 and IIS 5.0. I ran the .ASP file from a virtual
directory - and experienced the failure.

I uploaded the test .ASP code on my hosting service's
server, and confirmed that it indeed works just fine.

So I guess now my question is - Why would it not work on
my workstation? I do believe my hosting service is using
IIS 6.0, but I doubt that's the reason for the difference.

I suspect there is a sercurity or permissions issue. Any
ideas?

Many thanks!
 
J

Jon Spivey

Hi,
I bet you have norton anti virus on your system? If so you need to disable
script blocking - it will cause filesystemobject to hang

Jon
Microsoft MVP - FP
 
J

Jim Buyens

Joe said:
Thanks for the quick reply Jim.

My trials were on my local workstation, running Windows
2000 and IIS 5.0. I ran the .ASP file from a virtual
directory - and experienced the failure.

I uploaded the test .ASP code on my hosting service's
server, and confirmed that it indeed works just fine.

So I guess now my question is - Why would it not work on
my workstation? I do believe my hosting service is using
IIS 6.0, but I doubt that's the reason for the difference.

I suspect there is a sercurity or permissions issue. Any
ideas?

It's hard to say without knowing the exact statement where the
timeout occurs. Maybe you can add some Response.Writes to narrow
this down.

If necessary, download the FileMon utility from www.sysinternals.com,
fire it up on your W2K Workstation, and then reproduce the failure.
FileMon will show you (among other things) which file accesses failed.

Jim Buyens
Microsoft FrontPage MVP
http://www.interlacken.com
Author of:
*----------------------------------------------------
|\---------------------------------------------------
|| Microsoft Office FrontPage 2003 Inside Out
|| Microsoft FrontPage Version 2002 Inside Out
|| Web Database Development Step by Step .NET Edition
|| Troubleshooting Microsoft FrontPage 2002
|| Faster Smarter Beginning Programming
|| (All from Microsoft Press)
|/---------------------------------------------------
*----------------------------------------------------
 
J

Joe

Yep - Script Blocking in Norton Anti-Virus was causing my
problems. Thanks Jon - and Thanks Jim (I've read your
books - good stuff)
 

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

Top