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 1 1895
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)
"Bala" <Ba**@discussions.microsoft.com> wrote in message
news:54**********************************@microsof t.com... 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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Michael |
last post by:
I am trying to allow a user to view a PDF in a new window. I
currently have this working using the following:
<a href="./pdf.do?parameter=01121980" target="top"><b>pdf</b></a>
The problem...
|
by: chon |
last post by:
I have an ASP page that is sent a file location as a parameter. It opens
this file, loads the ADODB.Stream object and does a binary write to the page
forcing the download dialog to appear. This...
|
by: Noor |
last post by:
please tell the technique of centralize exception handling without try catch
blocks in c#.
|
by: Oney |
last post by:
Can I catch windows taskbar mouse events with Javascript( on the
taskbar right click mouse and click close on the menu)
When browser is open, on the taskbar mouse right click, click window...
|
by: hoenes1 |
last post by:
Hi,
in my ASP.NET App, I have a list of files which the user can download
on click (using Response.BinaryWrite()). the problem is, that once a
download has started, the user can't navigate in...
| |
by: tony |
last post by:
Hello!
I have a mainManu where I can chose to display some window forms.
When the mainMenu is minimized I need to minimize every window form that is
started from the mainMenu.
So I need to...
|
by: =?Utf-8?B?Q2hyaXNB?= |
last post by:
Two questions:
1. I have several asp.net pages that initiate a file download, via
Response.WriteFile(). This works fine, except that it leaves the original
page up. These pages are generally...
|
by: ah.ping.luk |
last post by:
Dear All,
i want to catch the application event (WM_CLOSE) in a user control.
i create a class that implement the IMessageFIlter interface as
follow:
...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |