Download ASP.NET Response.BinaryWrite file using SSL

I have a page that generates a dynamic file for upload and sends it to the client using Response.BinaryWrite.

Everything works fine, except when we moved it to a test server with SSL. The download happens in a new window, and what I see (in IE7 / 8, but not chrome or FF) opens and closes the tab, but the File dialog box does not appear.

Here the full headline writes:

Response.Clear()
        Response.Buffer = True
        Response.ContentType = "application/octet-stream"
        Response.AddHeader("Content-Length", abytFileData.Length.ToString)
        Response.AddHeader("cache-control", "private")
        Response.AddHeader("Expires", "0")
        Response.AddHeader("Pragma", "cache")
        Response.AddHeader("content-disposition", "attachment; filename=""" & pMsg!pstrFileName & """")
        Response.AddHeader("Accept-Ranges", "none")
        Response.BinaryWrite(abytFileData)
        Response.Flush()
        Response.End()

I'm sure my problem was what was mentioned here ,

But my cache control is correct. Any ideas?

+5
source share
3 answers

, , , IE. "" - " " โ†’ "" , , " " . "". , : http://www.codeproject.com/KB/aspnet/SecureFileDownload.aspx

+2

. :

# BinaryWrite SSL

, :

Response.Clear();

...

Response.ClearContent();
Response.ClearHeaders();
+3

Expires Pragma? PDF SSL:

Response.Buffer = True
Response.ClearContent()
Response.ClearHeaders()
Response.AddHeader("Cache-Control", "max-age=3")
Response.AddHeader("Pragma", "public")
Response.ContentType = "application/pdf"
Response.AddHeader("Content-Disposition", "attachment; filename=file.pdf")
Response.AddHeader("Content-Length", mem_stream.Length.ToString)
Response.BinaryWrite(mem_stream.ToArray())
Response.Flush()
Response.End()
+1

All Articles