我是一個傳統的ASP頁面轉換爲.net和跨越這段代碼傳來:更新傳統的ASP方法,.exe文件,流媒體用戶
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
我沒有在.NET,所以我這樣做之前我想知道什麼是'.exe文件流向用戶的正確方法?謝謝。
可能重複http://stackoverflow.com/questions/736301/asp-net-how-to-stream-file-to-user http://stackoverflow.com/questions/5596747/download-stream-file-from-url-asp-net – Lloyd 2012-03-20 01:30:48
不是,另一個是關於如何形成網址來獲取文件,然後流式傳輸,我的問題是'什麼是標準或最佳實踐! – flavour404 2012-03-20 01:40:08
沒有「最好」的方法。你張貼的方式是可以接受的。 – 2012-03-20 22:24:15