473,385 Members | 1,958 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

directory listing

Hello,

I'd like my asp.net page to display a list of hyperlinks representing
the
files contained in a specific directory. The contents of this
directory
will change, but the directory does not contain any subfolders, only
pdf
files. The resulting list of hyperlinks should not allow a user to
'save
link as', to download the file, but rather only allow the user to view
the
file in their browser. What is the easiest way to get such a list on
my
page?

Thanks
Jun 27 '08 #1
2 1656
1. Create a directory /PDFs in your webfolder and mark it in IIS or you
deployment project as readable.
2. In your app list the directory using system.io.file / directory
namespaces
3. foreach directory read filename and path into a structure

an easy way is to create a dataset with a table (filename, date, etc...).
Adv. is you can bind that to a datagrid where you can use a link / template
column to show your link
--
Holger Kreissl
..NET Software Developer
http://kreissl.blogspot.com/
Hello,

I'd like my asp.net page to display a list of hyperlinks representing
the
files contained in a specific directory. The contents of this
directory
will change, but the directory does not contain any subfolders, only
pdf
files. The resulting list of hyperlinks should not allow a user to
'save
link as', to download the file, but rather only allow the user to view
the
file in their browser. What is the easiest way to get such a list on
my
page?

Thanks
Jun 27 '08 #2
On Apr 15, 9:03*pm, Jesse.Aufi...@gmail.com wrote:
Hello,

I'd like my asp.net page to display a list of hyperlinks representing
the
files contained in a specific directory. *The contents of this
directory
will change, but the directory does not contain any subfolders, only
pdf
files. *The resulting list of hyperlinks should not allow a user to
'save
link as', to download the file, but rather only allow the user to view
the
file in their browser. *What is the easiest way to get such a list on
my
page?

Thanks
Example:

Dim dir As New IO.DirectoryInfo(Server.MapPath("/dir"))
Dim fis As IO.FileInfo() = dir.GetFiles()
Dim fi As IO.FileInfo

For Each fi In fis
Response.Write(fi.Name)
Next fi
Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Dean | last post by:
Hi I've got a question relating to using Javascript on an Intranet. I have a directory with a list of files in the format week36.xls, week37.xls and I want to write a script that will scan...
19
by: SU News Server | last post by:
I've struggled with this for quite a while and I'm am just not sure what is going on. I have the following code import os def buildList( directory='/Users/mkonrad' ) dirs = listing =...
2
by: Tom | last post by:
I need to get a directory listing through http. If I put the directory path in the browser address bar such as http://somewebpage.com/subdir I get the listing of the directory. Of course this is...
8
by: gil | last post by:
Is it possible to prevent a browser from listing the entire contents of a folder? The site, is hosted on my ISP with the following layout- site/ "user name from ISP" pagefile (dir)...
2
by: ngr | last post by:
I used to use the DirListox control in VB6 but this is no longer supported in VB.NET. What I want to do: I want to take a directory listing and show any subdirectories in a list. When you click...
8
by: dougawells | last post by:
Hi - I'm hoping for help with the auto-generation of a hyperlinked listing of all files in a directory. The server I use does not auto-generate this. So, when someone comes to this directory and...
7
by: epikto | last post by:
I have a mapped share that I am trying to get a listing of all the files that it contains. I use the following code to access the contents String files = Directory.GetFiles(path); I can then...
4
by: techusky | last post by:
I have a *very* simple script written that displays the directory listing of the current working directory, but I am having some difficulty when I try to change folders. Basically, I have my $dir...
2
by: marcusadeleon | last post by:
Hi, I was wondering how to open up a web directory to get a file listing. The directory I want to open allows directory listings, but has a directory password. Meaning it gives me a prompt to...
1
by: Steve | last post by:
My site is hosted on a Godaddy reseller site. Godaddy only allows the use of Curl to access remote sites. What is the method for listing a directory after connecting to the site with Curl? ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.