R
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.Value, 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
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.Value, 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