I want a functionality in which i want following thing:
when i open a page created by me for download, it should dynamically create links for all the documents present in particular directory.
for eg: if i have folder at web server as /download/document
and i have following document in this folder
a.txt
b.txt
c.doc
d.pdf
now when i open page then i should have 4 links each for these of documents n when i click on this link, the file can be downloaded
Using
System.IO.Directory.GetFiles("Path to folder")you can get list of files directory contains andRequest.PhysicalPath.Substring(0, Request.PhysicalPath.LastIndexOf("\\")))will get you the physical path to the folder that contains your aspx file.Then iterating through each file and using Request.Url you can generate download link.