Displaying folder contents as links?

J

Jim in Arizona

Anyone know a way or a document that shows how to display the contents
(word & excel docs, etc) of a folder as links on a web form that link to
the document?

TIA,
Jim
 
B

Brennan Stehling

Jim,

You can turn on Directory Indexing in IIS for a given folder. It can
be dangerous for obvious reasons, but you can do it. It is also just a
black and white page, so if you want a look and feel for it you will
not get it.

To make it a little more secure you could create a page which will give
you the file listing for given folder. Use the Request.PhysicalPath to
get the location of a folder and create a DirectoryInfo object for that
folder. Then iterate the Files collection and show links for the
extensions you want exposed. You could produce a decent looking page
this way with filtering on the allowed extensions.

http://msdn2.microsoft.com/en-us/library/system.web.httprequest.physicalpath.aspx

Brennan Stehling
http://brennan.offwhite.net/blog/
 

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,777
Messages
2,569,604
Members
45,226
Latest member
KristanTal

Latest Threads

Top