Download exe files from the database

I have some exe files that I uploaded to my database, since I do not want them to be public. I tried using the link button and the general handler to work with the file using the following code:

Context.Response.Clear()
Context.Response.ContentType = "application/exe"
Context.Response.AppendHeader("Content-Disposition", "filename=program.exe")
Context.Response.BinaryWrite(binaryfile)

Problem: Google Chrome does not treat downloads like any other exe, instead, after downloading reports, "program.exe usually does not load and can be dangerous." with the "cancel" button and the ability to "save" the download is hidden in the context menu.

Is there any other / better way to service exe files stored in a database?

+3
source share
3 answers

application/exe . application/octet-stream .

.NET, , IIS. ( , ). , (, ) MIME .

, - . , , , , .

+4

: Chrome

Jeff G Google - . Google , , .

+3

In my case, I solved it with the following set of headers:

Cache-Control: max-age=864000
Content-type: application/octet-stream
Content-Disposition: attachment; filename="....zip"
Content-Transfer-Encoding: binary
Last-Modified: ...
Etag: ...
Content-Length: ...

Be more attentive to Content-type, Cache-Control, Last-Modified, and Etag, which seemed to be useful headers for me.

+1
source

All Articles