Help with showing contents of files in a particular folder on a web page!!!

Posted on 2005-05-10
Last Modified: 2011-09-20
Hi, I am developing my website.  On one of the pages I list various projects, when a user clicks on one of the projects  
A page is then displayed asking for username and password.  
Have sorted that out using ASP.Net.

When the user then correctly eneters the username and password.  He is taken to the page of that particular project.

How do I get to list all the files of that particular project onto the webpage.  So that they can then choose a particular file to download.
You can assume that all the files are in the designated folders for each project.

Hope someone can help cheers

Any advice would be appreciated or links to tutorials etc.

Question by:dthomas31uk
    LVL 15

    Expert Comment


    Author Comment

    Cheers for that joeposter649.  That works a treat, was thinking might be easier to create PDF files of the files in the folder and just enter links on the webpage.....what do you think????

    Obviously wont be able to edited anything, but that will not be a problem.
    LVL 15

    Accepted Solution

    You'd have more control if you streamed the files rather than giving a direct link.  This would allow you to do things such as move the files out of the webroot, check permissions, add http headers etc.  
    Here's a quick example...

    <%@ Import Namespace="System.IO" %>

            'Set the appropriate ContentType.
            Response.ContentType = "application/rtf"
            Response.AddHeader("content-disposition", "attachment; filename=test.rtf;")
            Response.Charset = "UTF-8"

            'Write the file directly to the HTTP output stream.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
    JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
    Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
    The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now