Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_web_howto thread: Listing/Downloading contents of remote share


Message #1 by cfriese@p... on Thu, 7 Nov 2002 13:53:52
Greetings,

I need to somehow work the below asp code so that it lists the contents 
of a shared folder on my file server to a web page that is located on a 
different IIS server.  I understand that my filepath needs to read 
\\fileservername\sharename but I am unclear on what to use for the 
<option value="http://ISO/ISO/ISO Forms-Procedures/I S/forms/<%=strName%
>"><%=strName%> since it needs to download from a location that is remote.
I code below allows everything to work if all of the source is on the IIS 
server.

[SNIP]
<%@LANGUAGE="VBSCRIPT"%>
<%
	Option Explicit	

	Dim filePath
	Dim myFileobj, myFolderobj, myfilelist, myFile
	Dim strName

	'specify the fullpath of the folder you're reading
	filePath = "C:\inetpub\wwwroot\ISOWeb\ISO\ISO Forms-Procedures\I 
S\forms\"

	' create a system file object
 	Set myFileobj = Server.CreateObject("Scripting.FileSystemObject")

	' create an object for the folder
	Set myFolderobj = myFileobj.GetFolder(filePath)
	
	' create a list of all file in the folder
	Set  myfilelist = myFolderobj.Files
%>
<!--- This will loop through each file and create an select box option 
for each file --->

	
	<p><B>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Select Your Desired Form:</b>
		<BR>
		<BR>
		
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<select 
onchange="if(this.value != '')document.location.href=this.value">
<option value="">Select Form</option>
<%

	' loops through all files in the list
	For Each myFile in  myfilelist

		' get a file's name
		strName = myFile.Name
		
		' makes sure that only file with extension txt are 
returned 
		if myFileobj.GetExtensionName(strName) = "doc" or 
myFileobj.GetExtensionName(strName) = "doc" then
%>

<option value="http://ISO/ISO/ISO Forms-Procedures/I S/forms/<%=strName%
>"><%=strName%>

<%
  end if
	Next
%>

</select>
</ul>

  Return to Index