By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,491 Members | 3,230 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,491 IT Pros & Developers. It's quick & easy.

IE File Download Dialog

P: n/a
RN1
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
Aug 8 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On Aug 8, 11:46*am, RN1 <r...@rediffmail.comwrote:
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
Aug 8 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.