Redirecting after downloading files using Response.WriteFile
Posted on 2007-12-05
I have a button on a web page that calls the following code in the aspx.vb file:
Dim strFile As String = "xxxxx.pdf"
Dim path As String = Server.MapPath(strFile)
Dim file As System.IO.FileInfo = New System.IO.FileInfo(path)
Response.AddHeader("Content-Disposition", "attachment; filename=" & file.Name)
Response.ContentType = "application/octet-stream"
I would like to redirect the user to a 'thank you' page after the download but if I insert a response.redirect statement after the response.writefile statement neither the writefile nor the redirect work. Can anyone tell me how I can resolve this?