Problem with downloading a file from a database

L

LoneWolf

I am trying to allow a user to download a file that has been stored within
a database. So far I am able to retrieve the binary information from the db
and show it in the web browser (in the instance of text or an image file).
However, what I am wanting, is to allow the user to download it directly to
their computer without having it displayed in the browser.

Below is the code I have:

Public Sub LinkButton1_Click(ByVal _oSender As Object, ByVal _e As
System.EventArgs)
Dim iKey As Integer = Integer.Parse(CType(_oSender,
LinkButton).CommandArgument)
Dim fFile As DocMGR.File = CType(alFiles(iKey - 1), DocMGR.File)
Response.BinaryWrite(CType(fFile.getFile, Byte()))
End Sub

the BinaryWrite writes the content directly to the page... which is not what
I am wanting.

Any suggestions on how to get the data to transfer directly to the user's
hard drive?
 
N

ng

I suggest first storing the file from the database to a file on the
server, then have the stored file downloaded to the user.

T
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top