asp.net upload faq
» How to
» Download Source Code
» ASP.NET Upload Control
Quickstart: Download from the filesystem
This quickstart will walk you through building a handler to support downloads from the server filesystem.
An ASP.NET site with a page you want to use to handle downloads. This example is downloadable as an ASP.NET 2.0 web site solution, but the code and settings described below will work exactly the same in any version of ASP.NET (v1.0-v3.5). For ASP.NET 1.0, see the workaround in the Stream file download how to entry.
» Creating a download handler
First, you need to create a handler resource that will perform the actual download to the client. You could use an aspx, but since its just a file download the whole page lifecycle isn't needed. In this case, it's better to use an ashx, which is basicaly a barebones endpoint. This avoids the unneccessary overhead of the aspx.
To create the download handler
After adding the handler, the handler source code should look like this:
» Adding download code
Now that the handler shell exists, we need to add code to actually perform the download. Information about the important sections can be found in the how to:
To add code to the download handler
Now when this handler gets hit for a valid file the user gets a download box – with file name:
© 2013 Krystalware
Painless ASP.NET file uploads