Displaying Files with a Hyperlink to download them
page 1 of 2
Published: 13 Nov 2003
Unedited - Community Contributed
Use the DirectoryInfo and FileInfo classes of System.IO namespace to display all the files in a directory with a Hyperlink to download them.
by Rajiv R.
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 25863/ 26
Article Contents:


Someone requested for help on displaying all the files in a directory with a Hyperlink to download it, and this is in reponse to that!

It quiet simple! We use the DirectoryInfo and FileInfo classes of System.IO namespace.

System.IO.DirectoryInfo di=new System.IO.DirectoryInfo("C:\\Inetpub\\wwwroot\\WebApplication2");

View Entire Article

User Comments

Title: to download file how to set path on hyperlink   
Name: bp sharma
Date: 2011-05-02 6:28:21 AM
i want download file from database using hyperlink in gridview
how i set path in "NavigateUrl" property please give complete solution thanxxx
Title: Nice Article .....   
Name: Shailesh
Date: 2010-06-18 6:24:07 AM
It is really a nice article ,with small and useful code
Title: fine   
Name: really
Date: 2009-01-19 5:50:45 AM
workrd fo me
Title: download dialogbox print button   
Name: Rashda
Date: 2008-10-17 6:01:48 AM
plz tell me how to remove print button from the file download dialog box
Title: huh???   
Name: AW
Date: 2008-06-17 3:07:04 PM
I don't get it? there's code all over the page. Please organize ur code so I can understand what ur doing..????
Title: more details   
Name: krithi
Date: 2006-07-25 1:08:42 AM
Need more details to download files. This code above just helps to navigate to the URL.
Title: Not clear   
Name: Lucky
Date: 2006-06-23 2:23:03 AM
Topics are good. But solutionsa re not clear.PLz make them clear.
Title: failed   
Name: Danny
Date: 2006-05-29 6:57:29 AM
This code doesnt helps to download files.
When I use this code in ASP.NET (VB), I navigate to corresponding link. I cant even do right-click/save target as option
Title: Help   
Name: vino
Date: 2006-02-16 4:13:43 AM
how to set a hyper link for a file which contains list information
Title: Help   
Name: Ram Konara
Date: 2005-05-19 8:28:52 PM
I need to Map to a shared drive on a remote Server using a ID and Password from ASP.Net. Get the File Information from the shared Drive and Disconnect the Shared drive. Please help me
Title: not complete   
Name: shu
Date: 2005-05-12 4:57:55 AM
i wanna know how to actually download the files
Title: Poor grammer, but simple and to the point.   
Name: Brunhilde
Date: 2004-11-03 11:37:19 PM
I'd like to see more info about how the files are downloaded though.

Product Spotlight
Product Spotlight 

Community Advice: ASP | SQL | XML | Regular Expressions | Windows

©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-04-13 10:06:52 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search