How do I use response.redirect to send a stream to be downloaded?
My ASPX code looks like this
Dim ms As New MemoryStream
printDoc.Save(ms, False)
Dim byteArray As Byte() = ms.ToArray()
ms.Flush()
ms.Close()
With HttpContext.Current.Response
.ClearContent()
.Clear()
.AddHeader("Content-Disposition", "attachment; filename=" & userData.eeTemplate & "s.pdf")
.AddHeader("Content-Length", byteArray.Length.ToString())
.ContentType = "application/octet-stream"
.BinaryWrite(byteArray)
.Redirect(mypage.aspx, False)
.End()
End With
However, "MyPage.axpx" does not then show the download symbol at the top right. What am I doing wrong?