Here is an example of how you can do this using VB.Net. You can easily do it in C#, but the syntax is obviously slightly different, but the concept is the same. In the following example, I have a PDF file called AndroidDevelopment.pdf I want to provide it as a download (replace with your own pdf filename and path). Here is how it is done:
1. Create an aspx page called Download.aspx.
2. Add a LinkButton to the page:
Since what we are going to trap is the OnClick event, you don't have to use a LinkButton, you can use anything you want that produces Onclick events or any event for that matter. You just need to trigger the code in step three to initiate the transfer.
3. In the code-behind, add a handler for the OnClick and add the following code to the handler:
4. Open Download.aspx in the browser and see how it looks. It should be what you are looking for.
Here is how it works:
1. when the click event fires, The first line, Response.ContentType set the Mime type of data that will be set back to the browser. In this case, it is "application/pdf". If you are sending jpg files, then it will be "image/jpg". For Word files it will be "application/ms-word". To figure out the proper Mime type, do a search using Google. I did the following search to find the pdf content type: response.contenttype pdf files.
2. The next line, Response.AppendHeader adds some more information to tell the browser you have an attachment. Just make sure the filename parameter is the name of the file. This is what shows up in the Save Dialog box.
3. The third line tells the server what file it needs to send to the browser.
4. The final line ends the Response.
As long as you provide some sort of clickable link and the Response code on the server for the correct file, it should work fine for you. Let me know how it goes.