11
Jul

I’m totally new to ASP so please be patient. I'm trying to find a code that’ll let me display the contents of a certain folder on my website as hyperlinks, and I'd enjoy it to be dynamic because I'll be uploading new files to the folder all the time. I found a code at brainjar.com that seems to do exactly what I want, but I can't get it to work.

http://www.brainjar.com/asp/dirlist/

http://www.brainjar.com/common/viewsourc…

I've copied the source code into a file I've named “power.asp” and changed <% ListFolderContents(Server.MapPath("/powe... %> in the “body” section of the html code, deleting the other two commands. I want the page to display the contents of a folder called “/powerpoint” which is an immediate subfolder of the folder that “power.asp” is in.

When I try to open the page, I get an error that the “path” is not found. No amount of fiddling on my part is helping.

Any help??


Answer:
Try removing the starting “/” from Server.MapPath(”/powerpoint”).

The starting “/” tells MapPath to map the path to the power point directory in the root of your website. So if you .asp file is in:

http://mysite.com/myapp/power.asp, MapPath will anticipate to find the powerpoint directory at mysite.com/powerpoint not mysite.com/myapp/powerpoint


Answer:
Did you use: Server.MapPath(”/powerpoint/”)

or just Server.MapPath(”/powerpoint”)

If you did add the trailing slash, try placing a preceeding period like: ./powerpoint/

Alternately, you could send the full path to the MapPath() command… c:/somefolder/somesubfolder/etc/wherever…


Answer:
Check out http://www.webdesignteam.ca

Book Mark it-> del.icio.us | Reddit | Slashdot | Digg | Facebook | Technorati | Google | StumbleUpon | Window Live | Tailrank | Furl | Netscape | Yahoo | BlinkList

This entry was posted on Friday, July 11th, 2008 at 4:08 pm and is filed under Programming. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or TrackBack URI from your own site.

Leave a reply

Name (*)
Mail (*)
URI
Comment