Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Why can't I use GetFolder() method of FileSystemObject on a networked drive?

391 views
Skip to first unread message

John Roets

unread,
Feb 22, 1999, 3:00:00 AM2/22/99
to
Using FileSystemObject within VBScript and ASP...

For any remote drive on the server, I cannot use GetFolder(). For example,
if I do the following:

set fs = Server.CreateObject("Scripting.FileSystemObject")
set folder = fs.GetFolder("F:")

I get the following errror:

Server object error 'ASP 0177 : 800a004c'

Server.CreateObject Failed

/default.asp, line 1

The operation completed successfully.

As another example, if I do the following:

set fs = Server.CreateObject("Scripting.FileSystemObject")
set drive = fs.GetDrive("F:")
response.write drive.isReady

I get the following:

False

Why? "F:" is not a floppy drive or a cd-rom drive. It is a hard drive on a
remote server. I can access it no problem from windows nt explorer. The
above failures occur for any networked drive I try.

John


Eric Lippert (Microsoft Scripting Dev)

unread,
Feb 22, 1999, 3:00:00 AM2/22/99
to
OK, well first of all, the first error has nothing to do with the folder --
you are unable to create the file system object. Perhaps it is not properly
installed. Try finding scrrun.dll on your machine and run "regsvr32
scrrun.dll" and try again.

The second problem is a security problem. ASP runs in a security context
which forbids access to network drives. You need to change your security
settings on the server to allow access to these drives. (No, I don't know
how -- I write compilers for a living, I have no idea how web server
security administration works!)

Eric

John Roets <jro...@auragen.com> wrote in message
news:uxclC$nX#GA....@uppssnewspub05.moswest.msn.net...

Clarence Washington Jr.

unread,
Feb 22, 1999, 3:00:00 AM2/22/99
to
The best way would be to configure IIS to use another user other than IWAM_computername or wrap it in a dll running from transaction server.
 
Clarence

--
Check it out..
 
 
On this site you will find resources for all of your scripting needs.
Everything you need to get up and running. Over 100 Sample
Scripts, ActiveX controls, reference materials, and technical support
via an online discussion lounge.
 
[ Win32Scripting... automate!! ]
Eric Lippert (Microsoft Scripting Dev) <Eri...@Microsoft.com> wrote in message news:O3qzyPpX#GA....@uppssnewspub05.moswest.msn.net...

John Roets

unread,
Feb 22, 1999, 3:00:00 AM2/22/99
to
The first error does not have to do with the filesystemobject... because I
get no error if I use a local drive in my call to GetFolder() or if I
comment out the call to GetFolder().

As you said, though -- and after reading some more myself -- it does seem to
be a security issue.

If someone could outline exactly what needs to be done to get this to work,
I would greatly appreciate it. Or perhaps someone can point me to an
already-written server-side component that can do this for me.

John

Eric Lippert (Microsoft Scripting Dev) wrote in message ...

Michael Harris

unread,
Feb 22, 1999, 3:00:00 AM2/22/99
to
You have to authenticate your users...

If you use NTLM Authentication, you are limited to true drive letters on the
server. If you use Basic Authentication, you can use UNC names referencing
a share on the same or another server. From a security point of view, as
soon as you use UNC, it looks like a machine hop and for that you need user
credentials to respond to the challenge/response. NTLM doesn't give IIS the
credentails (username/password) needed to respond. Of course the server's
file system ACLs have to allow the user the appropriate level of access you
need them to have.

--
=======================
|| Mike Harris
|| mailto:mik...@safeco.com
=======================

John Roets wrote in message ...

Michael Harris

unread,
Feb 22, 1999, 3:00:00 AM2/22/99
to
Server object error 'ASP 0177 : 800a004c'

004c (hex) = 76 decimal...

76 = Path not found

If "F:" is a mapped network drive letter pointing to a network share, then
"F:" won't mean anything except to a locally logged on interactive user who
maps "F:" to something...

--
=======================
|| Mike Harris
|| mailto:mik...@safeco.com
=======================

John Roets wrote in message ...

David E. Stockbridge

unread,
Feb 23, 1999, 3:00:00 AM2/23/99
to
I stole this from Ken Cross in another newsgroup, who stole it from still
someone else in still another newsgroup. I have played with it and it works.

Dave

>>>Begin quote:
In answering another question in the public newsgroups, I stumbled across
how you can use UNC's in an FSO operation, e.g.,

Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile("\\192.168.1.253\cdrive\boot.bak",1)
Response.Write f.ReadAll
f.Close
Set f = Nothing
Set fso = Nothing

To do this, the page must run under an account that is defined on both the
web server and the remote machine. So the first step is to create a user
account on both systems with the same password. (You can't use the default
IUSR_machinename unless you set the password manually -- I haven't tried
this.)

Set up the page or directory or whole site to use that user account. In
MMC:

1. Right-click the virtual server, directory, or file in question.
2. Select Properties.
3. Select Directory Security (File Security for a single file).
4. Select "Edit" in "Anonymous Access and Authentication Control".
5. Select "Allow Anonymous Access" to enable the "Edit" control.
6. Select "Edit".
7. Clear the "Enable Automatic Password Synchronization" option.
8. Enter the account and password that's valid on both machines.

Security is an issue, of course, so make sure the user account doesn't have
any more privileges than necessary.

But it works. This would be a good addition to a FAQ somewhere.

Ken


Michael Harris

unread,
Feb 23, 1999, 3:00:00 AM2/23/99
to
> Server object error 'ASP 0177 : 800a004c'

004c = 76 decimal

Error 76 = Path not found

> set folder = fs.GetFolder("F:")

If "F:" is drive letter mapped to a network share, it won't be seen even by
an authenticated user. It's my understanding that mapped drives are visible
only to the logged on interactive user who mapped the drive.

John Roets

unread,
Feb 24, 1999, 3:00:00 AM2/24/99
to
Setting up an identical user on the remote machine was the answer for me.

I found some useful articles at Microsoft's site:

http://support.microsoft.com/support/kb/articles/q197/9/64.asp, entitled
"PRB: Cannot Access Remote Files with the FileSystemObject."

http://support.microsoft.com/support/kb/articles/Q184/5/66.ap, entitled
"HOWTO: Set Up Duplicate Anonymous Accout on Separate Server".

Finally, http://msdn.microsoft.com/library/techart/msdn_authentication.htm,
entitled "Authentication and Security for Internet Developers".

Thanks to all for the help.

John

David E. Stockbridge wrote in message ...

Frank W Molski

unread,
Apr 29, 1999, 3:00:00 AM4/29/99
to John Roets
John,
The articles are mentioning NT-based file systems. Is the solution
going to work with Netware-based file server?

Regards,
Frank

0 new messages