accessing files on another computer

R

Rosanna

I'm pretty new to ASP, so please bear with me...

I'm setting up an ASP web page that includes listing the
files in a folder (which are hyperlinked so
the user can open the files). This folder is located on
another computer so on my webserver, I've got a mapped
drive to that folder called Z:.

I executed the code below code to list the drives on my
webserver, but it only shows physical drives - A,C, and D
(cd-rom). Therefore, I can't access files on the Z drive
if it doesn't detect it! I know it's been done before
with a small ListFiles program I found online and on
another older webserver, so there must be something I'm
missing..

Also, I'm not sure this this has anything to do with it,
but I'm logging into the webserver via Remote Desktop to
modify files. I mapped a drive this way, but when I went
to the actual webserver, the mapped drive didn't show up!
I did map the drive, but I'm still having problems
accessing it through the web.

The error that shows up on the web is pretty
undescriptive:

Microsoft VBScript runtime error '800a004c'
Path not found

/index.asp, line 238


I'd would appreciate advice and comments. Thanks!


<%
Dim fso, connectedDrives, drv
Dim strInfo, driveName
Set fso = Server.CreateObject
("Scripting.FileSystemObject")
Set connectedDrives = fso.drives
On Error Resume Next
For Each drv In connectedDrives
strInfo = strInfo & drv.DriveLetter & ": "
' Check if the drive is shared
If drv.DriveType = 3 Then
driveName = drv.ShareName
Else
driveName = drv.VolumeName
End If
strInfo = strInfo & driveName
strInfo = strInfo & " Free space: " &
drv.FreeSpace
If drv.IsReady Then
strInfo = strInfo & " ready" & "<br>"
Else
strInfo = strInfo & " not ready" & "<br>"
End If
Next
Response.Write strInfo & "<br>"
Set connectedDrives = Nothing
Set fso = Nothing
%>
 
R

Rosanna

Thanks for the prompt reply, Curt.

I tried using a UNC using the code below, but it still
says Path not found and I know the path is valid.

Set objFolder=fso.GetFolder("\\server\shared folder")

I also tried setting up a virtual directory in IIS 6.0
and executed the following:

Set objFolder=fso.GetFolder(Server.MapPath
("sharedfolder"))
The virtual directory is in the same folder as the page
I'm trying to execute.

Comments/advice are welcome. Thanks!
 
R

Rosanna

Also, when I created the virtual directory, it asked for
a username and password to access the share - would this
be the IUSR? if so, would I need to go into explorer and
add IUSR to the permissions? right now in IIS, i've got
it specified so anonymous access is allowed.
 
R

Rosanna

Ok, so I've got
a virtual directory setup in IIS to \\server\share,
anon (IUSR) login allowed on the website,
File system permissions for anon logon for \\server\share

But I'm still receiving Path not found.

Thanks for all the help you've been providing. Any other
ideas?
 
R

Rosanna

<%
Dim fso, objFolder
dim fname, fcollection, strDirectoryPath, strUrlPath

Set fso = CreateObject("Scripting.FileSystemObject")

Set objFolder = fso.GetFolder(Server.MapPath
("VirtualDirectoryAlias"))
//error: Path not found

Set fcollection = objFolder.Files

'print the links
For Each fname in fcollection
fname=right(fname,len(fname)-InStrRev(fname, "\"))
Response.Write "<A HREF=""" & fname & """>" & fname
& "</A><BR>"

Next
%>


For the objFolder line, I've also tried:

Set objFolder = fso.GetFolder("\\server\shared folder")
'error: Path not found

and..

Set objFolder = fso.GetFolder("VirtualDirectoryAlias")
'error: Path not found

and..

Set objFolder = fso.GetFolder(Server.MapPath
("\\server\shared folder"))

'error:
'Server.MapPath() error 'ASP 0174 : 80004005'
'Invalid Path Character(s)
'/index.asp, line 232
'An invalid '/' or '\' was found in the Path parameter
'for the MapPath method

If the path is c: or something ON the webserver, it
works.
 

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

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top