Get ready for BLACK FRIDAY shopping starting in

Forums

ASP

This topic is locked

HELP???!!! Jus a quick question....

Posted 31 Mar 2004 15:29:41
1
has voted
31 Mar 2004 15:29:41 A B posted:
Hi i jus have a quick question regarding the code that can be accessed via the link below...

What it is, is that i would like to access a folder from a different server outside of the server which the code is saved in. Is this possible??

The code line below should be changed i guess i have tried writing in the server name but this does not work.. help!!

sDirectory = "../" 'Where "sDirectory" is the top level browsable directory

The code was found from the following link

www.4guysfromrolla.com/webtech/code/searchengine.search.asp.html

THANKS!!

Replies

Replied 01 Apr 2004 00:55:15
01 Apr 2004 00:55:15 Phil Shevlin replied:
Not unless both servers are controlled by you. Any then only if you allow it (groups/permissions). Otherwise, I could search your harddrive for files.
Replied 01 Apr 2004 13:39:43
01 Apr 2004 13:39:43 A B replied:
Yes they are both controlled by me, sorry about the above link i typed in the wrong one! the code i am using is shown below!

What it is, is that i would like to access a folder from a different server outside of the server which the code is saved in.

The code below should be changed i guess i have tried writing in the server name but this does not work.. help!!

Line 88:

sDirectory = "//servername" 'Where "sDirectory" is the top level browsable directory

Lines 125 to 155
'Get subfolder (sDir) from passed querystring
sDir = sDirectory & Request.querystring("dir"
sDir = trim(sDir)
If right(sDir,1) <> "/" Then sDir = sDir & "/"

'This next part of code keeps users from browsing directories outside of the shared.
'It puts the user back into the default directory.

sFolder = Server.MapPath( sDir )
sDirFolder = Server.MapPath( sDirectory )
sSubFolder = right(sDir,len(sDir)-len(sDirectory))

If instr( sFolder , sDirFolder ) = 0 Then
sFolder = sDirFolder
sSubFolder = ""
sError = sError & " Path not authorized;" 'Does not authorise folders to be viewed outside share
End If

'This loads the file system and navigates to the shared folder.
Set objFileObject = Server.CreateObject("Scripting.FileSystemObject"
Set objFolder = objFileObject.GetFolder( sFolder )

'If the folder cannot be found or has been misspelled we can use the following code
If IsEmpty( objFolder ) Then
sFolder = sDirFolder
sSubFolder = ""
sDir = sDirectory
Set objFolder = objFileObject.GetFolder( sFolder )
sError = sError & " Folder not found;"

End If
Replied 01 Apr 2004 13:55:40
01 Apr 2004 13:55:40 Phil Shevlin replied:
I don't think is a "what code" thing. Just map a drive or create a virtual directory so that the folder(s) . The network admins guys usually make this happen.

Reply to this topic