[Last Call] Learn how to a build a cloud-first strategyRegister Now


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

Posted on 2006-05-19
Medium Priority
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
  • 2
  • 2
LVL 19

Expert Comment

by:Melih SARICA
ID: 16721729
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


Author Comment

ID: 16721750
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: 16721848

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

Sammy Ageil earned 1000 total points
ID: 16723284

Author Comment

ID: 16764391
I ended up using this article that made it work:


Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

831 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