Displaying folder contents as links?

  • Thread starter Thread starter Jim in Arizona
  • Start date Start date
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
 
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/
 
Back
Top