Can anyone tell me what's wrong with this code?
Apologies in advance to anyone who thinks that I'm one of those people who starts multiple threads about the same problem, but my other posting was more by way of a reply to the otehr poster's query, rather than a plea for help with my problem.
Anyway, I have a web site onto which I'd like to put some confidential documents (mainly MS Word and PDF files) and have them only accessible to persons who have logged in.
I already have the login processes sorted out. What I am having trouble with is adapting the chapter 10 code to give a directory listing of my 'private' files, and enable my authorised members to download them by clicking on their names.
My web server's folder tree looks like this:
| |--files... |---DisplayDirectory.asp
OK, so I have my modified bit of Wrox code from Chapter 10 in the 'members' folder, and my 'private' files in the private directory (which is inaccessible by entering a URL). My modified code can display a directory listing of the /private folder, but I can't figure out how to make the server deliver the files from the /private folder when the links are clicked. What ssems to happen when the links are clicked is that the server tries to fins a file with that name in the /htdocs/members folder (i.e. where the DisplayDirectory.asp file lives).
How do I make the server fetch the files from /private?
Here's my code:
<TITLE>Display Directory (modified)</TITLE>
strPhysicalPath = Server.MapPath("../../private/dummy.asp")
Dim objFSO, objFile, objFileItem, objFolder, objFolderContents
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.GetFile(strPhysicalPath)
Set objFolder = objFile.ParentFolder
Set objFolderContents = objFolder.Files
<TH align=left>File Name</TH>
<TH align=left>File Type</TH>
For Each objFileItem In objFolderContents
if objFileItem.Name="dummy.asp" Then
<A HREF="<%= objFileItem.Name %>"><%= objFileItem.Name %></A>
<%= objFileItem.type %>
<%= objFileItem.size %>
<%= objFileItem.DateLastModified %>
Thanks in advance for any assistance