Create a Download file link, for a file outside web server directory

Posted on 2006-05-19
Last Modified: 2012-06-21
Hello everyone,

I'm trying to set up a file upload and download section on my website, and I want to secure the files uploaded by placing in a directory outside the webserver.

How can I create a download file link, so that my users are the only ones that can download them? Or send me the link to an article that explains it.

Question by:quanmac
    LVL 19

    Expert Comment

    by:Melih SARICA
    u cant create a download link outside ur webserver..

    What u can do is .. to create a link to a aspx page..
    in this aspx page.. u can load the file from the secure place  outside ur webserver. and then change response headers. and flush the loaded file back to client..

    this can be a solution other wise u cant create a link to a file outside ur webserver

    Melih SARICA
    LVL 3

    Author Comment

    That's what I meant, was that I needed to find out how to create the aspx page to get the file from a file outside the web server.

    Can you point me to some articles to do this?
    LVL 19

    Expert Comment

    by:Melih SARICA

    id ur files are in different types? lost of types or just a few ?

    if they r not..

    create a download.aspx. page.
    on page load event.

    create a stream reader that ll load the desired file in to the stream ..
    then change to response.contenttype property to the mime type of ur file
    then response.write to send ur stream that contains file.. then response.flush

    this ll send the file to the client

    LVL 27

    Accepted Solution

    LVL 3

    Author Comment

    I ended up using this article that made it work:;en-us;812406

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
    User art_snob ( encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    how to add IIS SMTP to handle application/Scanner relays into office 365.

    728 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

    18 Experts available now in Live!

    Get 1:1 Help Now