I can't get ASP to force a download and redirect
I have code that works for forcing a download but I also need to redirect to another page. However I can't get both to work together. Below is the code I have to force the download but response.redirect nor server.transfer or server.execute work along with this code.
<%
Response.Buffer=true
On Error Resume Next
'Create a stream object
Dim tfm_downloadStream
Set tfm_downloadStream = Server.CreateObject("ADODB.Stream")
tfm_downloadStream.Type = 1
tfm_downloadStream.Open
tfm_downloadStream.LoadFromFile Server.Mappath("lakelogo_mac.eps")
If Err.number = 0 Then
Response.Clear()
Response.ContentType = "application/octet-stream"
Response.AddHeader "Content-Disposition", "attachment; filename=lakelogo_mac.eps"
Response.AddHeader "Content-Transfer-Encoding","binary"
Response.BinaryWrite tfm_downloadStream.Read
tfm_downloadStream.Close
Set tfm_downloadStream = Nothing
Else
tfm_downloadStream.Close
Set tfm_downloadStream = Nothing
Response.Redirect("../index.htm")
End If
'Basic-UltraDev BUD_ForceDownload server behavior
%>
|