catch IE download window event

G

Guest

Hi

When the user clicks the download button on my aspx page, the file (pdf)
downloaded from my server another drive. Once he clicks the button, I
inserted the record on one of table. after that the IE will ask do you want
to open or cancel, the user may click cancel button. so in this situtation, i
need to insert the record on table once the user click save button. if the
user clicks the cancel, I should not insert the records. how to catch that
event. any idea?

and also i have the file name like "file, user.pdf". when using Firefox, its
just display the "file," on downloading window. is it any chance to resolve
this?

below is the code i am using for downlading the file.

thanks
bala


Private Sub DownloadFile(ByVal fname As String, ByVal forceDownload As
Boolean)
Dim path1 As String = fname
Dim name As String = Path.GetFileName(path1)

Dim ext As String = Path.GetExtension(path1)
'Dim type As String = "Application/pdf"
Response.ContentType = "Application/pdf"
If forceDownload Then
Response.AppendHeader("content-disposition", "attachment;
filename=" & name)
Else
Response.AppendHeader("content-disposition", "inline;
filename=" & name)
End If
Dim MyFileStream As FileStream
Dim FileSize As Long

MyFileStream = New FileStream(fname, FileMode.Open)
FileSize = MyFileStream.Length

Dim Buffer(CInt(FileSize)) As Byte
MyFileStream.Read(Buffer, 0, CInt(FileSize))
MyFileStream.Close()
Response.BinaryWrite(Buffer)

Response.End()
End Sub
 
B

Bruce Barker

you can't. if you need this feature, you need to supply an active/x control
that does the download, and gives the notification.

note: IE downloads the file to the cache, then asks the question. even if
you say canel, you can access the file from the cache.

-- bruce (sqlwork.com)
 

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

Members online

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,708
Latest member
SherleneF1

Latest Threads

Top