I am completely stuck here. Basically, I am serving a file to the user by sending it using Respnse.BinaryWrite. I am also sending this on a redirected page so as not to destroy the Response stream of the webpage which fired the filedownload. This works perfect on my development machine, it also works perfect on Firefox.
However, if I publish to my test server, on IE 8 (and 7 I presume) a security warning bar appears (does not appear in dev mode on my pc), asking the user to accept or decline the file. Now the not-so-funny thing: If the user accepts, the file is NOT served, I just get back to my main webpage. If the user tries a second time to get the file the security question will NOT pop up again and the file is served.
How can I make sure the file is served in the first instance if the user accepts the security warning and wants to download?
Thank you very much for your support, greatly appreciated!
Marc
Code used:
Expand|Select|Wrap|Line Numbers
- HttpContext.Current.Response.Clear()
- HttpContext.Current.Response.AppendHeader("Content-Disposition", String.Format("attachment; filename={0}", Session("FileName")))
- HttpContext.Current.Response.AppendHeader("Content-Length", myReportData.Length.ToString())
- HttpContext.Current.Response.ContentType = "application/pdf"
- HttpContext.Current.Response.BinaryWrite(myReportData.ToArray)
- HttpContext.Current.Response.Flush()
- HttpContext.Current.Response.End()