I am converting a classic asp page to .net and came across this piece of code:
Sub SendBinaryFile(b_FileName)
tool = Server.MapPath("bin/" & b_FileName)
Response.AddHeader "Content-Disposition", "attachment;filename=" & b_FileName
Response.ContentType = "application/octet-stream"
Set BinaryStream = CreateObject("ADODB.Stream")
BinaryStream.Open
BinaryStream.Type = 1
BinaryStream.LoadFromFile tool
Response.BinaryWrite BinaryStream.Read
BinaryStream.Close
Set BinaryWrite = Nothing
End Sub
I have not done this before in .net so I am wondering what is the 'correct way to stream a .exe file to the user? Thanks.