Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > IE File Download Dialog

Reply
Thread Tools

IE File Download Dialog

 
 
RN1
Guest
Posts: n/a
 
      08-08-2008
In an ASP.NET app, users can upload their files to a remote server as
back-up. I want to give users the provision to download files that
they have uploaded to the remote server to their local machine. This
is how I am invoking the file download dialog box that pops up in IE6
(users click a Button):

Sub btn_DwnldFile(ByVal obj As Object, ByVal ea As EventArgs)
Dim strURL As String = 'getting the file name

Response.ContentType = "application/octet-stream"
Response.AddHeader("Content-Disposition", "attachment;filename=" &
strURL)

'hdnCurrentDir is a hidden Form element
Response.TransmitFile(hdnCurrentDir.Value & "\" & strURL)
Response.TransmitFile(Path.Combine(hdnCurrentDir.V alue, strURL))
Response.Flush()
Response.End()
End Sub

As such the above code invokes the IE file download dialog
successfully but the problem is in the file download dialog box, if
the user clicks the 'Open' button (instead of clicking the 'Save'
button to save the file in his local machine), then the file opens up
in the same window. I did like the file to open up in a new window.

I am not sure how to go about implementing this. Can someone please
give me some idea on how to do this?

Thanks,

Ron
 
Reply With Quote
 
 
 
 
Alexey Smirnov
Guest
Posts: n/a
 
      08-08-2008
On Aug 8, 11:46*am, RN1 <(E-Mail Removed)> wrote:
> In an ASP.NET app, users can upload their files to a remote server as
> back-up. I want to give users the provision to download files that
> they have uploaded to the remote server to their local machine. This
> is how I am invoking the file download dialog box that pops up in IE6
> (users click a Button):
>
> Sub btn_DwnldFile(ByVal obj As Object, ByVal ea As EventArgs)
> * * Dim strURL As String = 'getting the file name
>
> * * Response.ContentType = "application/octet-stream"
> * * Response.AddHeader("Content-Disposition", "attachment;filename=" &
> strURL)
>
> * * 'hdnCurrentDir is a hidden Form element
> * * Response.TransmitFile(hdnCurrentDir.Value & "\" & strURL)
> * * Response.TransmitFile(Path.Combine(hdnCurrentDir.V alue, strURL))
> * * Response.Flush()
> * * Response.End()
> End Sub
>
> As such the above code invokes the IE file download dialog
> successfully but the problem is in the file download dialog box, if
> the user clicks the 'Open' button (instead of clicking the 'Save'
> button to save the file in his local machine), then the file opens up
> in the same window. I did like the file to open up in a new window.
>
> I am not sure how to go about implementing this. Can someone please
> give me some idea on how to do this?
>
> Thanks,
>
> Ron


You can replace the button by a link to the separated webform (e.g.
download.aspx) with target=_blank
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
File name is displayed Garbled in "File download dialog box" =?Utf-8?B?SWJyYWhpbS4=?= ASP .Net 0 08-12-2006 06:44 AM
Force Open .OFT file in Outlook do not show File Download Dialog Kele ASP .Net 0 07-14-2005 06:27 AM
How to hide the dialog when execute a dialog based application in VC? yw C++ 3 07-02-2005 03:35 AM
display print preview dialog, not print dialog Matt Javascript 1 11-20-2004 01:18 AM
Strange characters displayed in file name - File Download Dialog - IE Daniel Cardoso ASP .Net 1 09-24-2004 05:19 PM



Advertisments